我遇到一个奇怪的问题,当我单击打开弹出窗口时,代码会冻结 10-12 分钟,然后与弹出窗口正常交互。以下是完整代码:
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir")+ "\\exe\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.get(prop.getProperty("https://genpact-qa-smartit.onbmc.com"));
driver.findElement(By.xpath("//*[@id='okta-signin-username']")).sendKeys(userid);
driver.findElement(By.xpath("//*[@id='okta-signin-password']")).sendKeys(pwd);
driver.findElement(By.xpath("//*[@id='okta-signin-submit']")).click();
driver.findElement(By.xpath("//a[@id='header-search_button']")).click();
driver.findElement(By.xpath("//input[@id='globalSearchBox']")).sendKeys("CRQ000000029504");
Robot robot=new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
driver.findElement(By.xpath("//a[text()='View Full Change']")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//div[@title='Print']")).click();
Thread.sleep(3000);
Actions a = new Actions(driver);
a.moveToElement(driver.findElement(By.xpath("//button[contains(text(),'Print Change')]")));
a.click();
a.perform();
Set<String> window_handles=driver.getWindowHandles();
String child=null;
System.out.println(window_handles.size());
for(String handle:window_handles) {
child=handle;
}
单击“打印更改”10-12 分钟并单击新弹出窗口上的“打印”按钮后,以上代码将冻结。
操作系统:Windows 10;浏览器:Chrome 77.0.3865.90;硒 3.141.59
任何帮助,将不胜感激。
POPMUISE
相关分类