Python Selenium Grid:在会话上安装chrome扩展
在chrome浏览器中的Selenium Grid测试中,我需要使用chrome Store中的一个chrome扩展,但我遇到了一些问题:(Python Selenium Grid:在会话上安装chrome扩展,python,selenium,google-chrome-extension,selenium-grid,Python,Selenium,Google Chrome Extension,Selenium Grid,在chrome浏览器中的Selenium Grid测试中,我需要使用chrome Store中的一个chrome扩展,但我遇到了一些问题:( 我试图在浏览器(.)中转到扩展URL并按键安装,但无法在弹出的浏览器窗口中确认安装 我试图下载crx扩展名文件,但后来我在浏览器中打开它,我看到了确认窗口,不知道如何确认安装 我尝试过使用这种方法——添加JSON文件并运行浏览器——不起作用,但我在Mac上尝试过,而不是在Linux上 webdriver.remote只能使用FireFox选项(seleni
// Add ChromeDriver-specific capabilities through ChromeOptions.
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
您还可以使用远程web驱动程序:
DesiredCapabilities capability = DesiredCapabilities.chrome();
// above code goes here...
WebDriver driver = new RemoteWebDriver(new URL(hubUrl), capability);
我无法将Chrome选项用于webdriverRemote。只有FirefoxOptions:(请参阅:当我使用SeleniumGrid时,我需要使用webdriverRemote。只有这样才能更新远程web驱动程序的答案。
DesiredCapabilities capability = DesiredCapabilities.chrome();
// above code goes here...
WebDriver driver = new RemoteWebDriver(new URL(hubUrl), capability);