如何使用Selenium远程Webdriver在隐身模式下启动Edge浏览器? [英] How to start Edge browser in Incognito mode using selenium remote webdriver?

查看:666
本文介绍了如何使用Selenium远程Webdriver在隐身模式下启动Edge浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我们正在使用C#通过Edge浏览器开发硒(2.53.0). 边缘浏览器由于存在缓存而将缓存信息存储在"localAppdata"文件夹中,因此在执行测试用例时会遇到一些问题.

Currently we are working on selenium (2.53.0) with Edge browser using C#. Edge browser stores cache information at 'localAppdata' folder because of cache, we are facing some issues while test cases execution.

我尝试使用硒(DeleteAllCookies)删除所有cookie信息,但不适用于Edge浏览器.

I try to delete all cookies information using selenium (DeleteAllCookies) but it not working for Edge browser.

当我们以隐身模式启动Edge浏览器时,我读了几个Microsoft论坛,这是跳过缓存的唯一方法.

I read couple of Microsoft forums only way to skip cache, when we start Edge browser on incognito mode.

任何人都可以建议如何使用Selenium remote-webdriver以私有(隐身模式)启动Edge浏览器实例

Can any one suggest how to start Edge browser instance in private (incognito mode) using selenium remote-webdriver

推荐答案

如果要以私有(隐身)模式打开Edge,可以使用以下C#代码:

if you want to open Edge in Private (Incognito) mode, you can use this C# code:

EdgeOptions options = new EdgeOptions();
options.AddAdditionalCapability("InPrivate", true);
this.edgeDriver = new EdgeDriver(options);

这篇关于如何使用Selenium远程Webdriver在隐身模式下启动Edge浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆