我试图建立一个自动测试环境
- TestStack.Seleno v0.8.2
- TestStack.BDDfy v4.0.0
- Selenium .NET WebDriver 2.43.0.0
- Chrome v38
- ChromeDriver v2.9 虽然我能够在chrome驱动程序和chrome浏览器之间建立初始会话握手,但随后通过chrome驱动程序对实际web应用程序的调用由于超时异常而失败。
下面是实例化SelenoHost对象的代码:
var options = new ChromeOptions();
Instance.Run(configure => configure
.WithWebServer(new InternetWebServer(String.Format("http://{0}/portal", IISServerHost)))
.WithRemoteWebDriver(() => BrowserFactory.Chrome(options))
.UsingLoggerFactory(new ConsoleFactory()));如果调试上述方法调用,则在SelenoApplication Initialize方法中失败:
public void Initialize()
{
_initialised = true;
_logger.Debug("Starting Webserver");
WebServer.Start();
_logger.Debug("Browsing to base URL");
Browser.Navigate().GoToUrl(WebServer.BaseUrl); >>> this line fails inside HttpCommandExecutor.CreateResponse() method
}我不知道我在这里错过了什么。
顺便说一句,web应用程序托管在IIS 7.5上,并配置为windows身份验证。
发布于 2014-11-04 04:15:19
用“无沙箱”启动铬解决了这个问题。
最后的配置如下所示:
var options = new ChromeOptions();
options.AddArgument("ignore-certificate-errors");
options.AddArgument("no-sandbox");
var driverService = ChromeDriverService.CreateDefaultService();
driverService.EnableVerboseLogging = (ChromeDriverVerboseLogigng == "true");
driverService.LogPath = ChromeDriverLogPath;
_SelenoHostLazy.Value.Run(configure => configure
.WithWebServer(new InternetWebServer(String.Format("http://localhost/portal", IISServerHost)))
.WithRemoteWebDriver(() => new ChromeDriver(driverService, options))
.UsingLoggerFactory(new ConsoleFactory()));https://stackoverflow.com/questions/26706545
复制相似问题