RemoteWebDriver:触摸操作不起作用,异常“ OpenQA.Selenium.WebDriverException”

时间:2018-11-16 07:58:33

标签: c# selenium selenium-webdriver automation webdriver

我对TouchEvents和RemoteWebDriver有问题。从自动化测试的目的出发,我需要使用通过VS Android仿真器通过Appium服务器运行的RemoteWebDriver

因此,经过大量的谷歌搜索和搜索,我制作了这个代码块,这给了我例外。 注释

  1. 此代码块不包含服务员,因为它是调查问题时的临时块,因此将线程睡眠用作临时等待
  2. 元素使用的定位器正确,单击是否正常

    [TestMethod]
        public void TestMethod1()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability("deviceName", "donatello");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("udid", "169.254.190.187:5555");
            capabilities.SetCapability("platfomVersion", "6.0.0");
            capabilities.SetCapability("browserName", "Browser");
    
            String baseURL = "http://127.0.0.1:";
            String minorURL = "/wd/hub";
            String port = "4723";
    
            RemoteDriverWithTouchScreen driver = new RemoteDriverWithTouchScreen(new Uri(baseURL + port + minorURL), capabilities);
    
            var touchActions = new OpenQA.Selenium.Interactions.TouchActions(driver);
    
            driver.Navigate().GoToUrl("page_url");
    
            touchActions
                .SingleTap(driver.FindElement(By.XPath("some_locator")))
                .Build()
                .Perform();
        }
    
        public class RemoteDriverWithTouchScreen : RemoteWebDriver, IHasTouchScreen
        {
            public ITouchScreen TouchScreen => new RemoteTouchScreen(this);
    
            public RemoteDriverWithTouchScreen(Uri url, ICapabilities cap) : base(url, cap)
            {
    
            }
        }
    

例外: OpenQA.Selenium.WebDriverException:处理命令时发生未知的服务器端错误。原始错误:无法代理。代理错误:无法将命令代理到远程服务器。原始错误:404-“未知命令:session / 5390590e73f152540d99a9623e1dd19a / actions”

0 个答案:

没有答案