在selenium中以inconginto模式运行chrome浏览器 [英] Run chrome browser in inconginto Mode in Selenium
本文介绍了在selenium中以inconginto模式运行chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过硒在 incongito
模式下运行chrome。
我使用了足够的搜索引擎,并发现如何在 incongito
模式下直接运行chrome,并且借助此链接:
I want to run chrome in incongito
mode through selenium.
I googled enough for it and found how to run chrome directly in incongito
mode with the help of this link:
- 右键单击Google Chrome的快捷方式并选择属性。
- 在目标字段的快捷方式选项卡上添加-incognito到程序路径的末尾。因此,在目标字段中,应该有
C:\ Program Files(x86)\Google\Chrome\Application\chrome.exe-incognito
- Right click on the shortcut of Google Chrome and select "Properties".
- On "Shortcut" tab on the "Target" field add an –incognito to the end of program path. So in the "Target" field you should have
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" –incognito
但是我没有得到如何在selenium中运行这个。
but I didn't get how to run this in selenium.
推荐答案
在隐身模式下启动Chrome的另一种方式是添加arugument -incognito,如下所示:
One other way to launch chrome in incognito mode is add arugument -incognito like following
ChromeOptions options = new ChromeOptions();
options.addArguments("--incognito");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
这个解决方案适用于我。
This solution works for me.
这篇关于在selenium中以inconginto模式运行chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文