2017-11-01 9 views
2

私はここに記載されているよう私はドッキングウィンドウコンテナを使用していSeleniumサーバーとして.net core 2xunit.NETのコア - セレンRemoteWebDriver - PlatformNotSupportedException

を使用してSeleniumテストを実行しようとしています: コマンドを使用して、コンテナ実行https://github.com/SeleniumHQ/docker-selenium


docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome

テストコード

public void Test() 
{ 
    IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444"), new ChromeOptions()); 
    driver.Navigate().GoToUrl("https://www.google.com"); 
    var s = ((ITakesScreenshot)driver).GetScreenshot(); 
    s.SaveAsFile("screen.jpg"); 
} 

私がテストを実行しようとすると、私は例外を取得:私は、Linux上で実行しています

System.PlatformNotSupportedException : Operation is not supported on this platform. 
    at System.Net.SystemWebProxy.GetProxy(Uri destination) 
    at System.Net.ServicePointManager.ProxyAddressIfNecessary(Uri& address, IWebProxy proxy) 
    at System.Net.ServicePointManager.FindServicePoint(Uri address, IWebProxy proxy) 
    at System.Net.HttpWebRequest.get_ServicePoint() 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo) 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) 
    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 Automation.LoginTests.Test() in C:\Git\Automation\test\Tests\LoginTests.cs:line 29 

同じ結果(Debianの9)またはWindows 10 私が何か間違ったことをやっていますか?セレンは.NETコア2をサポートできるようです

+2

は、.NETコアの問題https://github.com/Azure/azure-iot-sdk-csharp/issues/140に思えます。彼らはまだこのメソッドを実装しておらず、これが動作するにはSelenium C#バインディングを変更する必要があります –

+0

スタックトレースからは、プラットフォームによって定義されたプロキシを検出できないようです。検出を無効にしてみてください: 'WebRequest.DefaultWebProxy = null;' –

答えて

関連する問題