[英]how to handle popup in selenium webdriver (which is not alert)?
2) A pop will display showing to enter email address to register. 2)将显示一个弹出窗口,显示输入要注册的电子邮件地址。
3) Since it is not a pop up I am not able to navigate to the window 3)因为它不是弹出窗口,所以我无法导航到窗口
I tried using alerts, javascriptexecutor and windowhandles but does not work. 我尝试使用警报,javascriptexecutor和windowhandles,但不起作用。 Could any suggest how to handle it?
可以建议如何处理吗?
This is not a popup window . 这不是一个弹出窗口 。 Locate it as you would locate any other element on a page.
找到它,就像在页面上找到其他任何元素一样。
For instance, here is how you can locate the "close" button and click it: 例如,这是找到“关闭”按钮并单击它的方法:
WebDriverWait wait = WebDriverWait(driver, 10);
WebElement closeButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.modal button.close")));
closeButton.click();
Note that we are using a WebDriverWait
explicit wait mechanism to wait for the close button to become visible. 请注意,我们正在使用
WebDriverWait
显式等待机制来等待关闭按钮变为可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.