user1700354
user1700354

Reputation: 107

Unable to locate button element

I can see the enabled button while running. I can select that button using Selenium IDE and the xpath. But when it comes to running using WebDriver it is not able to find the element.

Upvotes: 1

Views: 125

Answers (1)

DodoSombrero
DodoSombrero

Reputation: 777

Are you using the localhost? because sometimes if it takes some extra seconds for the Web Browser to load (for example Firefox), then when Selenium tries to do the action it doesn't find the elements obviously resulting your error.

Use the pause command, for example 5 seconds, so that the Selenium waits 5 seconds before the action is executed, giving time for the website to load.

Try the coding somewhere on this level

driver.manage().timeOuts().implicitlyWait(5,TimeUnit.SECONDS);

Upvotes: 0

Related Questions