webdriver未知错误:net::err\u name\u not\u resolved

waxmsbnn  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(257)

我想在azure devops中运行selenium web驱动程序

public class ListItemsTest {

    ChromeDriver driver;
    NgWebDriver ngWebDriver;

    @BeforeAll
    public void setupTest(){

        System.setProperty("sun.net.spi.nameservice.nameservers", "8.8.8.8");
        System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");

        WebDriverManager.chromedriver().setup();

        ChromeOptions options = new ChromeOptions();
        options.setCapability("applicationCacheEnabled", false);
        options.addArguments("--ignore-certificate-errors");
        options.addArguments("--headless");
        options.addArguments("--disable-gpu");

        driver = new ChromeDriver(options);

        ngWebDriver = new NgWebDriver(driver);
        ngWebDriver.waitForAngularRequestsToFinish();
    }
}

但看起来没有dns服务。我得到错误:

ListItemsTest.LoginTest:50 » WebDriver unknown error: net::ERR_NAME_NOT_RESOLV...
2020-11-18T18:29:17.7803528Z [ERROR]   LoginTest.LoginTest:96 » WebDriver unknown error: net::ERR_NAME_NOT_RESOLVED

你知道我怎么解决这个问题吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题