简体   繁体   中英

Selenium method works only in debug mode

I've come up against a weird problem! I am a noobie Selenium Framework user, but anyway I use:

wait.until(ExpectedConditions.invisibilityOfElementLocated(xpath)). 

This construction works in debug mode only, however, when I run test without debug, it seems like Compiler doesn't check this line.

It's a timing issue, the form might be considered invisible to the driver but the button is not loaded yet. In addition (or instead) to waiting for the form to disappear you should wait for the button to be visible and clickable

WebElement button = wait.until(ExpectedConditions.ElementToBeClickable(xpath));
button.click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM