简体   繁体   English

chrome扩展程序-如何使用chrome扩展程序调用webDriver(不在新标签中)

[英]chrome extension - how to invoke webDriver with chrome extension (not in a new tab)

i am trying to open webDriver with chrome extension (Modify header value) using below code 我正在尝试使用以下代码打开带有chrome扩展名(修改标头值)的webDriver

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); 

but this code is opening the webDriver instance with the extention in another window can any one know how to invoke it with chrome extension not in a new tab. 但是这段代码是在另一个窗口中打开具有扩展名的webDriver实例,任何人都可以知道如何使用chrome扩展名而不是在新标签页中调用它。

You may refer with this thread . 您可以使用此线程进行引用。 Be noted that Selenium supports interaction with web view only. 请注意,Selenium仅支持与Web视图的交互。 You can check this tutorial on how to test your Chrome Extension with selenium. 您可以查看有关如何使用硒测试Chrome扩展程序的本教程 However, you can also use of sikuli (Automation tool that make use of image recognition), to click the chrome add-on. 但是,您也可以使用sikuli (利用图像识别的自动化工具)单击chrome附加组件。 After that add-on popup will be another browser window, so use switch window to perform actions on add-on popup. 在该附加组件弹出窗口之后将是另一个浏览器窗口,因此请使用切换窗口对附加组件弹出窗口执行操作。 Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM