Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Appium:如何在windows 10上的chrome中测试Web应用程序?_C#_Windows_Automated Tests_Appium - Fatal编程技术网

C# Appium:如何在windows 10上的chrome中测试Web应用程序?

C# Appium:如何在windows 10上的chrome中测试Web应用程序?,c#,windows,automated-tests,appium,C#,Windows,Automated Tests,Appium,我正在尝试使用Appium对运行在chrome和Windows10上的web应用程序进行自动化测试。 我有下面这样的代码,使用chromedriver工作得非常好。我想将此转移到基于appium的方法 RemoteWebDriver driver = new ChromeDriver(@"C:\Users\Administrator\Downloads\chromedriver_win32"); driver.Manage().Timeouts().SetPageLoad

我正在尝试使用Appium对运行在chrome和Windows10上的web应用程序进行自动化测试。 我有下面这样的代码,使用chromedriver工作得非常好。我想将此转移到基于appium的方法

RemoteWebDriver driver = new ChromeDriver(@"C:\Users\Administrator\Downloads\chromedriver_win32");
            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(60));

driver.Url = "https://www.bing.com/";
RemoteWebElement element = (RemoteWebElement)driver.FindElementById("sb_form_q");
element.SendKeys("webdriver");
element.SendKeys(Keys.Enter);

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
wait.Until(x => x.Title.Contains("webdriver"));
我在互联网上搜索了很多代码,可以在windows设备上的android模拟器上测试chrome浏览器上的Web应用程序。我没有找到任何直接在Windows10上运行chrome浏览器的示例。 根据我所了解的情况,我尝试通过对所需功能进行如下更改来采用代码

DesiredCapabilities caps = DesiredCapabilities.Chrome();
caps.SetCapability(CapabilityType.BrowserName, "chrome");
caps.SetCapability(CapabilityType.Version, "60");
caps.SetCapability(CapabilityType.Platform, "Windows 10");
caps.SetCapability("platformName", "Windows");
//caps.SetCapability("app", @"C:\Users\Administrator\Downloads\chromedriver_win32\Chromedriver.exe");
caps.SetCapability("app", @"Chrome");
caps.SetCapability("deviceName", "WindowsPC");

driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4725/wd/hub"), caps, TimeSpan.FromSeconds(60));
driver.Url = "https://www.bing.com/";
((IWebDriver)driver).Navigate().GoToUrl("https://www.bing.com/");
RemoteWebElement element = (RemoteWebElement)driver.FindElementById("sb_form_q");
element.SendKeys("webdriver");
element.SendKeys(Keys.Enter);

Thread.Sleep(5000);
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
wait.Until(x => x.Title.Contains("webdriver"));
然而,这不起作用。 我认为问题在于我无法确定如何设置所需的功能,以便运行的appium服务能够启动chromedriver并运行测试

有人能帮我指出上面代码的错误吗?
感谢您的帮助。

您需要传递android手机的功能,而不是windwos pc的功能

caps.SetCapability("platformName", "Windows");
如果你正在使用仿真器或android手机,你需要通过它的OS版本

为了便于参考,请访问本网站,您将了解您需要了解的一切

很乐意帮忙。。让我们知道该解决方案是否适用于您

Appium是一个开源测试自动化框架,使用WebDriver协议a.k.a.Selenium API驱动iOS和Android本机、移动和混合应用程序。也就是说,Appium就像Selenium的表亲,用于测试移动应用程序,而不是桌面浏览器中的web应用程序


根据这里的讨论,appium似乎也只是用于在移动设备上进行测试。

我只是想澄清一下,我正在尝试在Windows 10上运行测试,而不是在android上运行。谢谢。但是你说你需要在模拟器上运行测试。如果我不清楚,很抱歉,事情是这样的。我正在尝试在chrome浏览器的Windows10上运行测试。接下来,我将尝试通过wpf应用程序中的chrome embedded(CEF)测试相同的web应用程序