简体   繁体   English

关闭硒java中的弹出窗口后无法识别对象

[英]unable to identify object after closing the pop up in selenium java

I am using Selenium Webdriver (using Java language) to automate my application. 我正在使用Selenium Webdriver(使用Java语言)来自动化我的应用程序。 My scenario is that, "Am supposed to click a button on a webpage, it will display the pop up, after I click some buttons in pop up, the pop up will get closed automatically and after that I need to enter some data into the webedit". 我的情况是,“应该单击网页上的一个按钮,它将显示弹出窗口,当我单击弹出窗口中的某些按钮后,该弹出窗口将自动关闭,然后我需要将一些数据输入到webedit”。

Now the issue am facing is that, am not able to enter the value into the webedit after closing the pop up. 现在面临的问题是,在关闭弹出窗口后无法将值输入到webedit中。 I am able to enter the value into the same webedit if I directly work with the webedit before I open the pop up. 如果我在打开弹出窗口之前直接使用Webedit,则可以将值输入到同一Webedit中。

You're probably using driver.switchTo().alert(); 您可能正在使用 driver.switchTo().alert(); . You have to switch back to your original window after closing the alert. 关闭警报后,您必须切换回原始窗口。

It sounds like you need to wait for the page to load after closing your popup. 听起来好像您需要在关闭弹出窗口后等待页面加载。

new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated(By.id("U_1L_1001"))).click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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