Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为Selenium WebDriver设置代理设置_C#_Selenium_Selenium Webdriver - Fatal编程技术网

C# 为Selenium WebDriver设置代理设置

C# 为Selenium WebDriver设置代理设置,c#,selenium,selenium-webdriver,C#,Selenium,Selenium Webdriver,在生成服务器执行selenium测试之前,我需要使用域、用户名和密码对代理服务器进行身份验证 我知道代理对象,但不确定如何正确设置HttpProxy属性 当由我们的生成服务器运行时,我得到以下异常: System.InvalidOperationException : session not created exception from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData"

在生成服务器执行selenium测试之前,我需要使用域、用户名和密码对代理服务器进行身份验证

我知道代理对象,但不确定如何正确设置HttpProxy属性

当由我们的生成服务器运行时,我得到以下异常:

System.InvalidOperationException : session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"3372.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: Opera with embedded Chromium 54.0.2840.87)
(Driver info: OperaDriver=0.2.0 (ba47709ed9e35ce26dbd960fb5d75be104290d96),platform=Windows NT 6.3 x86_64) (33)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Opera.OperaDriver..ctor(OperaDriverService service, OperaOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Opera.OperaDriver..ctor(String operaDriverDirectory, OperaOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Opera.OperaDriver..ctor(String operaDriverDirectory, OperaOptions options)

我已尝试使用netsh winhttp在系统级别设置代理设置,但这似乎没有影响

可能的重复:您只需要webdriver的会话与该代理连接,还是需要在测试之前对该服务器进行一次身份验证?我需要在测试之前对服务器进行一次身份验证测验。我的开发环境无法直接访问Internet,因此我必须通过经过身份验证的代理(不幸的是,我无法控制)您是否只需要webdriver的会话就可以使用该代理?或者您是否需要在测试之前对该服务器进行一次身份验证?我需要在测试之前对该服务器进行一次身份验证。我的开发环境无法直接访问Internet,因此我必须通过经过身份验证的代理(不幸的是,我无法控制)