您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

org.openqa.selenium.remote.UnreachableBrowserException:无法启动新的会话。可能的原因是远程服务器的地址无效

org.openqa.selenium.remote.UnreachableBrowserException:无法启动新的会话。可能的原因是远程服务器的地址无效

您必须在代码中考虑几个因素,如下所示:

在提及时,System.setProperty您需要提供 的绝对路径,如下所示:

System.setProperty("webdriver.gecko.driver", "C:\\your_directory\\geckodriver.exe");

一旦提及ImplicitlyWait,它将在程序执行期间保留下来。您可以考虑删除多个提及。

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        package demo;

    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;

    public class Q44308973_remote_unreachablebrowserexception {

    public static void main(String[] args) 
    {

    System.setProperty("webdriver.gecko.driver", "C:\\your_directory\\geckodriver.exe");
    DesiredCapabilities dc = DesiredCapabilities.firefox();
    dc.setCapability("marionette", true);
    WebDriver driver =  new FirefoxDriver(dc);
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get("https://google.com");
    }

    }   
其他 2022/1/1 18:15:10 有456人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶