设置Selenium WebDriver的代理设置

时间:2016-11-11 16:52:57

标签: c# selenium selenium-webdriver

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

我知道Proxy对象,但我不确定如何正确设置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在系统级别设置代理设置,但这似乎并没有产生影响

0 个答案:

没有答案