Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 是否可以在chrome headless中重用selenium会话?_Java_Selenium - Fatal编程技术网

Java 是否可以在chrome headless中重用selenium会话?

Java 是否可以在chrome headless中重用selenium会话?,java,selenium,Java,Selenium,我有一个上传序列代码,我正在使用远程调试运行,以保存每次验证。我想知道,由于某种原因,在计算机运行时,我不能使用计算机,会话是否可以同时进行无头和远程调试。如果chrome最小化,则无法找到某些元素 我有 // connect to remote debugging ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("debuggerAddress", "localhos

我有一个上传序列代码,我正在使用远程调试运行,以保存每次验证。我想知道,由于某种原因,在计算机运行时,我不能使用计算机,会话是否可以同时进行无头和远程调试。如果chrome最小化,则无法找到某些元素

我有

     // 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来实现<代码>选项。设置无头(真)