简体   繁体   English

.NET Core-Selenium RemoteWebDriver-PlatformNotSupportedException

[英].NET Core - Selenium RemoteWebDriver - PlatformNotSupportedException

I am trying to run Selenium test using .net core 2 and xunit 我正在尝试使用.net core 2xunit运行Selenium测试

As Selenium server I am using docker container as documented here: https://github.com/SeleniumHQ/docker-selenium 作为Selenium服务器,我正在使用Docker容器,如此处所述: https//github.com/SeleniumHQ/docker-selenium

Running container with command: 使用命令运行容器:
docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome

Test code 测试码

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");
}

When I try to run the test I get exception: 当我尝试运行测试时,出现异常:

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

Same result when I am running on linux (Debian 9) or Windows 10. Am I doing something wrong? 在linux(Debian 9)或Windows 10上运行时,结果相同。我做错了吗? Selenium seems to be able to support .NET Core 2 Selenium似乎能够支持.NET Core 2

Found an issue on github thanks to this comment . 由于此评论,在github上发现了一个问题。

https://github.com/SeleniumHQ/selenium/issues/4770 https://github.com/SeleniumHQ/selenium/issues/4770

Workaround with working code is described here: https://github.com/SeleniumHQ/selenium/issues/4770#issuecomment-337370420 使用工作代码的解决方法在此处进行了描述: https : //github.com/SeleniumHQ/selenium/issues/4770#issuecomment-337370420

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .NET Core 2.0 RSA PlatformNotSupportedException - .NET Core 2.0 RSA PlatformNotSupportedException .NET Core 2.0 中的 System.PlatformNotSupportedException - System.PlatformNotSupportedException in .NET Core 2.0 .NET Core:为什么 WaitHandle.SignalAndWait 在 Linux 上抛出 PlatformNotSupportedException - .NET Core: why WaitHandle.SignalAndWait throws PlatformNotSupportedException on Linux System.PlatformNotSupportedException 在运行时编译 C# 代码 .NET Core - System.PlatformNotSupportedException Compiling C# code at runtime .NET Core Selenium RemoteWebDriver中的NTLM身份验证 - NTLM authentication in Selenium RemoteWebDriver Selenium RemoteWebDriver内存问题 - Selenium RemoteWebDriver memory issues 错误:PlatformNotSupportedException:不支持配置文件或 .NET Core 6 如何使用 SOAP .NET 框架 Z775A8A743D2639430Z3A72AEEEC24 - error: PlatformNotSupportedException: Configuration files are not supported or How .NET Core 6 consume SOAP .NET Framework wcf "在 C# 中使用 Selenium RemoteWebDriver" - Using Selenium RemoteWebDriver in C# PlatformNotSupportedException使用.NET语音识别 - PlatformNotSupportedException Using .NET Speech Recognition PlatformNotSupportedException在.NET 4.0进程中加载​​.NET 2.0 - PlatformNotSupportedException Loading .NET 2.0 in .NET 4.0 Process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM