Java 是否可以在chrome headless中重用selenium会话?
我有一个上传序列代码,我正在使用远程调试运行,以保存每次验证。我想知道,由于某种原因,在计算机运行时,我不能使用计算机,会话是否可以同时进行无头和远程调试。如果chrome最小化,则无法找到某些元素 我有Java 是否可以在chrome headless中重用selenium会话?,java,selenium,Java,Selenium,我有一个上传序列代码,我正在使用远程调试运行,以保存每次验证。我想知道,由于某种原因,在计算机运行时,我不能使用计算机,会话是否可以同时进行无头和远程调试。如果chrome最小化,则无法找到某些元素 我有 // connect to remote debugging ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("debuggerAddress", "localhos
// connect to remote debugging
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("debuggerAddress", "localhost:9222");
当chrome最小化时失败的代码还有:
// click on zip
try {
WebElement element_1=driver_2.findElement(By.xpath("//*[text() = 'zip.zip']"));
WebDriverWait wait = new WebDriverWait(driver_2, 120);
wait.until(ExpectedConditions.elementToBeClickable(element_1));
element_1.click();
}catch (org.openqa.selenium.NoSuchElementException e) {System.out.println("no such element");}
你想在headless模式下运行上述代码吗?如果你想在headless模式下运行代码,你可以通过添加chrome选项headless来实现<代码>选项。设置无头(真)代码>