Selenium clicking element

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kcliffy
Posts: 9
Joined: 07 Jul 2016, 00:32

Selenium clicking element

20 May 2018, 23:47

Hi all,

I have an issue clicking elements in Selenium for Chrome. The following works in the chrome console:

Code: Select all

document.getElementsByClassName("clickable")[1].click()
However, I have tried the following and can't get any variations to worK:

Code: Select all

RPdriver.getElementsByClassName("clickable").item[1].WaitEnabled().click()
RPdriver.getElementsByClassName("clickable").item[1].click()
RPdriver.getElementsByClassName("clickable").item[1].Click
RPdriver.getElementsByClassName("clickable").item[1].SendKeys(RPdriver.Keys.ENTER)
RPdriver.getElementsByClassName("clickable").item[1].Attribute("innerText").SendKeys(RPdriver.Keys.ENTER)
I know it is something simple, but does anyone have any suggestions?


Thanks in advance,
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Selenium clicking element

21 May 2018, 02:33

JavaScript arrays are 0 based and selenium is 1 based.
Try:
RPdriver.getElementsByClassName("clickable").item[2].WaitEnabled().click()

HTH
kcliffy
Posts: 9
Joined: 07 Jul 2016, 00:32

Re: Selenium clicking element

21 May 2018, 04:44

Xtra wrote:JavaScript arrays are 0 based and selenium is 1 based.
Try:
RPdriver.getElementsByClassName("clickable").item[2].WaitEnabled().click()

HTH
Thanks Xtra, I do recall this from a tutorial video I watched. I've updated my code, however it still doesn't appear to activate the link. Any other ideas?
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Selenium clicking element

21 May 2018, 13:53

Is the element in a iFrame?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 394 guests