开发者社区> 问答> 正文

如何在使用WebDriverManager时设置Chrome选项?

我正在使用Web驱动程序管理器来设置chrome驱动程序。设置驱动程序时,我想添加一些chrome选项?使用Web驱动程序管理器时该怎么办?

我检查了WebDriverManager API但找不到任何线索..

展开
收起
小六码奴 2019-08-17 17:07:40 2817 0
1 条回答
写回答
取消 提交回答
  • public void WebDriverManagerTest() { //setup the chromedriver using WebDriverManager WebDriverManager.chromedriver().setup();

    //Create Chrome Options
    ChromeOptions option = new ChromeOptions();
    option.addArguments("--test-type");
    option.addArguments("--disable-popup-bloacking");
    DesiredCapabilities chrome = DesiredCapabilities.chrome();
    chrome.setJavascriptEnabled(true);
    option.setCapability(ChromeOptions.CAPABILITY, option);
    
    //Create driver object for Chrome
    WebDriver driver = new ChromeDriver(option);
    
    //Navigate to a URL
    driver.get("http://toolsqa.com");
    
    //quit the browser
    driver.quit();
    

    }

    2019-08-17 17:08:10
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载