findelementbyxpath not working for a part of webpage Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
ankitkraken
Posts: 80
Joined: 01 Jun 2019, 08:47
Location: India

findelementbyxpath not working for a part of webpage

09 Jul 2019, 06:15

Hi,

Code: Select all

ele := driver.findElementByxpath("//*[@id='pg-case-detail']/div[2]/div/div[2]/div/ul/li[12]/a")		;Click on Action Tab
driver.ExecuteScript("arguments[0].click();", ele)
I'm using the above code to click on a tab in a webpage, using xpath works for everything above that tab row, clicking on other tabs works as well, but if I try to click on any element, inside those tabs, it gives me an error saying the said element was not found. I have tried using findelementbyid as well. It could be that those tabs are opening different urls inside each tab, i'm not sure if that makes any sense. Please help.
User avatar
ankitkraken
Posts: 80
Joined: 01 Jun 2019, 08:47
Location: India

Re: findelementbyxpath not working for a part of webpage  Topic is solved

10 Jul 2019, 08:28

The reason for this is because inside each tab, the iframe changes.
I found a solution, you can search for iframe in the inspect element window. Find the correct iframe of the tab that you want, then open that link in the new tab and the use xpaths to get information.

Just leaving it out here in case someone needs this.
User avatar
tank
Posts: 2855
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: findelementbyxpath not working for a part of webpage

10 Jul 2019, 08:47

Much appreciated!!
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], brunohimalaya, JackbobEvolved, proactivematter, TAC109 and 48 guests