java - Element not recognized on page until a manual click on the page occurs -


I am looking for an element on a web page using my xpath. Xpath is correct and the element can be found only if I manually click on the page for the first time if I do not do this before the statement, then it will not get the element.

I have tried many attempts to focus on the page:

  selenium.selectWindow (null); Selenium.firivant (xpath, "focus"); Selenium.Click (element on page); Selenium.mouseDown (); Selenium.mouseUp ();  

After completing these tasks, the statement will still not be able to find the element, but if I maximize the page manually and click anywhere on the page, then say the statement The element is found. Can anyone help me with this?

I am using this element to find:

  selenium.isElementPresent ("// div [@ class = 'sample_class']");  

Thanks!

Instead of using XPath, the CSS selector for that item.

Use selenium.isElementPresent ("css = div.sample_class"); as your selector. Saucelabs explained this very well on


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -