我的目的是在浏览器堆栈上运行UI自动化脚本 我试图在浏览器堆栈上运行一个简单的示例测试 - 但是我遇到了错误 消息:System.PlatformNotSupportedException:此平台不支持操作 完整堆栈跟踪
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) –
我的代码如下所示:
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using NUnit;
using NUnit.Framework;
namespace SeleniumTest
{
[TestFixture]
[Parallelizable]
public class Program
{
IWebDriver _driver;
[SetUp]
public void init()
{
DesiredCapabilities capability = DesiredCapabilities.Chrome();
capability.SetCapability("browserstack.user", "<BrowserStack-Username>");
capability.SetCapability("browserstack.key", "<BrowserStack-Key>");
capability.SetCapability("browser", "Chrome");
capability.SetCapability("browser_version", "52.0");
capability.SetCapability("os", "Windows");
capability.SetCapability("os_version", "7");
_driver = new RemoteWebDriver(
new Uri("http://hub-cloud.browserstack.com/wd/hub/"), capability
);
}
[Test]
public void BSTTest4()
{
_driver.Navigate().GoToUrl("http://www.google.com");
Console.WriteLine(_driver.Title);
IWebElement query = _driver.FindElement(By.Name("q"));
query.SendKeys("Browserstack");
query.Submit();
Console.WriteLine(_driver.Title);
}
[TearDown]
public void cleanup()
{
_driver.Quit();
}
}
}