Issue
I'm using selenium 2.33 java to write automation scripts for a website.
I'm calling the Selenium.isElementPresent() function to check if an element exists in page, but sometimes the function waits for long time and then throws "timed out waiting for action to complete" Exception. I dont want the function to wait, because in my code, I've made sure the page has loaded fully before calling isElementPresent(), I just want the function to return true or false.
Does setting selenium.setTimeOute() has anything to do with this? , because I set it in my code in the beginning.
And is using driver.findElements().size()!=0 a better way to check element's presence?
All I need is to know if an element is present or not right away, not wait for it to appear.
Thanks in advance for your answers....
Solution
You'll want to set implicit wait to 0.
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.Timeouts.html
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp
Answered By - Spencer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.