I have a selenium code below which wait for the page to load before the action(click button) is performed. How do I do the same thing with HtmlUnit not HtmlUnitDriver.
driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='couple']"))).click();
I know there is this line of code below in HtmlUnit:
webClient.waitForBackgroundJavaScript();
But does it do the same thing?
No this is not the same.
ExpectedConditions.elementToBeClickablewaits until the element is there/visible and enabled.webClient.waitForBackgroundJavaScript(timeoutMillis)looks only for (async) JavaScript jobs and waits if there are still any that are currently running or waiting in the queue.