question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XPATH not working

See original GitHub issue

HI ,

As you can see in the attached pic, I dont have any way other than to find element by XPATH.

I tried Window, AnnotationID in XPATH but none of them are working.Can any one pls help.

image

DesiredCapabilities desktopCapabilities = new DesiredCapabilities();
    	desktopCapabilities.setCapability("app", "Root");
    	desktopCapabilities.setCapability("deviceName", "WindowsPC");
        driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723"), desktopCapabilities);
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
jdaApp=driver.findElementByName("JDA Solutions");
jdaApp.findElement(By.xpath("//*[@AnnotationID='010000807C142900FCFFFFFF00000000']")).click();

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PandaMagnuscommented, May 19, 2018

@sunnysachdeva You can get at the page source through the session. Right after this line of code: driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

Write a line of code like: var temp = driver.PageSource;

If you drop a breakpoint after this, you can inspect the variable, or you can save temp to a file. The two things to verify once you have the page source is:

  1. Has the driver picked up the application yet (basically, is there anything in the page source yet. If not, it’s probably just timing out before the application loads, and you can add in a wait before trying to search.)
  2. Is the annotation ID present, but maybe under a different property? E.G., I have a WPF app where the “AutomationID” in XAML gets translated to “AccessibilityID” in WAP.

Depending on what the page source displays, it should be easier to determine why this isn’t working.

0reactions
hassanuzcommented, Aug 16, 2018

Making issue as closed due to Panda’s resolution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why this Xpath not working?
My XPATH, //*[contains(text(), 'I want to find this')] does not work at all. ... However, if I remove the <span></span> from that HTML,...
Read more >
Xpath problem- cant locate the class
Above xpath not working because there a new line after button and 'primary' is in next line. 1. if only and only want...
Read more >
Xpath not working for some instances : r/sheets
Xpath not working for some instances. I am currently creating a google sheets for tracking csgo prices, and for some reason some of...
Read more >
xpath is not working | Edureka Community
Clicking on an element in robot framework is not working in IE, ... findElement(By.xpath()) not working using Selenium WebDriver.
Read more >
XPath not
The not() function inverts the meaning (and as such; the result) of the argument. The not() function can have different results from an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found