在所附的屏幕截图中,我要单击“新建浏览器窗口”。我想关闭浏览器窗口,然后单击“新消息”窗口。我关闭了浏览器窗口。但是我得到了例外
org.openqa.selenium.NoSuchWindowException: no such window: target window already closed
Run Code Online (Sandbox Code Playgroud)
屏幕截图
下面是详细信息 屏幕截图
下面是代码
@Test
public void testing()
{
driver.manage().window().maximize();
driver.get("http://www.seleniumframework.com/Practiceform/");
driver.findElement(By.id("button1")).click();
Set<String> handle=driver.getWindowHandles();
for(String handles:handle){
try{
String text=driver.switchTo().window(handles).getPageSource();
if(text.contains("Agile Testing and ATDD Automation")){
System.out.println("Text found");
driver.close();
break;
}
}catch(Exception e){}
}
driver.switchTo().defaultContent();
driver.findElement(By.xpath("//button[contains(text(),'New Message Window')]")).click();
driver.quit();
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 cypress 自动化 Orangehrm 网站(https://opensource-demo.orangehrmlive.com/index.php/auth/login)
我的用例
我尝试使用 cypress 但不知何故鼠标悬停不起作用。请建议点击 KPI 链接的最佳方式。
截图