什么是C#等效于Java ChromeOptions.setExperimentalOptions()?

时间:2014-03-07 07:42:17

标签: selenium selenium-chromedriver

我使用以下代码自动安装了Chrome浏览器:

DesiredCapabilities capabilities=DesiredCapabilities.chrome();
ChromeOptions options=new ChromeOptions();  

options.setExperimentalOptions("androidPackage", "com.android.chrome");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

WebDriver driver=new ChromeDriver(capabilities);
System.setProperty("webdriver.chrome.driver", "C://Users//Documents//Appium//ChromeDriver//chromedriver.exe");
String url="http://yahoo.com";
driver.get(url);

我正在尝试使用C#(Visual Studio)自动化Chrome浏览器,但找不到相应的代码。我正在使用它,但没有工作:

Capabilities = DesiredCapabilities.Chrome();
ChromeOptions options1=new ChromeOptions();
options1.AddAdditionalCapability("androidPackage", "com.android.chrome",);
Driver = new ChromeDriver(Chrome_Driver, options1);

1 个答案:

答案 0 :(得分:0)

我相信这就是你要找的东西:

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddAdditionalCapability("androidPackage", "com.android.chrome");

driver = new RemoteWebDriver(new Uri("http://seleniumhubaddress:4444/wd/hub"), chromeOptions.ToCapabilities());