运行Selenium脚本时获取"Timed out receiving message from renderer"



我使用的是Chrome v81和ChromeDriver vChromeDriver81.0.4044.20。我的selenium脚本正在成功运行,并且能够识别web元素。但我在那里使用了一个循环,它不起作用——

public static void main(String[] args) throws InterruptedException {
String projectPath = System.getProperty("user.dir");
System.setProperty("webdriver.chrome.driver", projectPath + "\Drivers\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://rahulshettyacademy.com/AutomationPractice/");
Thread.sleep(3000);
WebElement cb = driver.findElement(By.xpath("//input[@value='option1']"));
cb.click();
Thread.sleep(2000);
if (cb.isSelected())
cb.click();
Thread.sleep(3000);
List<WebElement> allCBs = driver.findElements(By.xpath("//input[@value='checkbox']"));
for (int i = 0; i < allCBs.size(); i++) {
System.out.println(i);
}
driver.close();
}

输出-

INFO: Detected dialect: W3C
[1588922113.669][SEVERE]: Timed out receiving message from renderer: 0.100
[1588922113.771][SEVERE]: Timed out receiving message from renderer: 0.100

使用以下命令更改您的xpath:

//*[@id='checkbox-example']/child::*/descendant::input

相关内容

  • 没有找到相关文章

最新更新