Adding extension to Selenium2(WebDriver) chrome driver

后端 未结 2 1293
感情败类
感情败类 2021-01-20 23:01

I\'m using the code below to start chrome using webdriver (selenium 2)

            Map mobileEmulation = new HashMap(         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-20 23:31

    Use below code:-

    ChromeOptions options = new ChromeOptions();
    options.addExtensions(new File("/path/to/extension.crx"));
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    ChromeDriver driver = new ChromeDriver(capabilities);
    

    Hope it will help you :)

提交回复
热议问题