Chrome Options 类似于FirefoxProfiles,用于定制待测试的Chrome 浏览器的特定属性

1)如果希望测试某个浏览器插件,可通过addExtensions方式提前加载以.crx 为扩展名的插件

2)如果希望Chrome 浏览器启动时附带启动参数,可通过addArguments 方式加载

3)如果希望指定机器上特定的某个Chrome 版本运行测试,尤其是同一个台机器上安装了多个不同版本的Chrome 时,可通过setBinary 指定待测试Chrome

示例代码

ChromeOptions options = new ChromeOptions();

 

options.addExtensions(new File("/path/to/extension.crx"));

options.addArguments("arguments list");

options.setBinary("/path/to/chrome");

 

WebDriver driver = new ChromeDriver(options);

相关文章:

  • 2021-07-13
  • 2021-06-04
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2022-01-08
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-25
  • 2021-05-11
  • 2021-12-21
  • 2022-12-23
  • 2022-01-28
相关资源
相似解决方案