0 votes
1 view
in Devops and Agile by (58.7k points)

I'm working on a Java Selenium-WebDriver. I added

driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

and

WebElement textbox = driver.findElement(By.id("textbox"));

because my Applications takes few seconds to load the User Interface. So I set 2 seconds implicitwait. but I got unable to locate element textbox

Then I add Thread.sleep(2000);

Now it works fine. Which one is a better way?

1 Answer

0 votes
by (23.1k points)

I am using webdriverJs (node.js),

driver.findElement(webdriver.By.name('btnCalculate')).click().then(function() {

    driver.sleep(5000);

});

The code above makes browser wait for 5 seconds after clicking the button.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...