2016-12-12 2 views
0

Appium WebDriver не может найти/найти элемент представления (например, UIButton) и не может щелкнуть по этому элементу. Я запускаю сервер Appium с помощью Appium.app на компьютере Mac.WebDriverException: код кодека или ответа не определен. Appium WebDriver не в состоянии найти UIButton

  • Mac OS: 10.11.6
  • XCode: 6,1
  • Appium: 1.5.3 (Ara)
  • iPhone 6, 8,1 Simulator
  • Java 1,8
  • Java-клиент: 4,1 0,2
  • Селен: 3.0.1

IOS настройки: Basic, Advanced и Settings

Source Code: 
public void setUp() { 
    try { 
     DesiredCapabilities capabilities = new DesiredCapabilities(); 
     capabilities.setCapability("deviceName", "iPhone 6"); 
     driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities); 
    } catch (MalformedURLException e) { 
     e.printStackTrace(); 
    } 
} 

public void startTest() { 
    try { 
     WebDriverWait waitObj = new WebDriverWait(driver, 2 * 60); 
     WebElement btnRegister = waitObj.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]"))); // Exception 
     btnRegister.click(); 
     //driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]")).click(); // Same exception here 
     driver.navigate().back(); 
     waitObj.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[2]"))).click(); 
     //driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[2]")).click(); 
     driver.navigate().back(); 
    }catch (Exception e){ 
     e.printStackTrace(); 
    } 
} 

org.openqa.selenium.support.ui.ExpectedConditions findElement ВНИМАНИЕ: WebDriverException брошенной findElement (By.xpath: // UIAApplication 1/UIAWindow 1/UIAButton 1) org.openqa.selenium.WebDriverException: код команды или ответа не определен. Недоступен для сборки Информация о сборке: версия: '3.0.1', редакция: '1969d75', время: '2016-10-18 09:49:13 -0700' Системная информация: хост: 'GMCSs-Mac-mini. local ', ip:' 192.168.1.24 ', os.name:' Mac OS X ', os.arch:' x86_64 ', os.version: '10 .11.6', java.version: '1.8.0_74' Driver информация: driver.version: RemoteWebDriver на org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:153) на org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:601) в io.appium.java_client.AppiumDriver.execute (AppiumDriver.java:180) по адресу org.openqa.selenium.remote.RemoteWebDriver.findElement (RemoteWebDriver.java:368) по адресу org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath (RemoteWebDriver.java:473) at org.openqa.selenium.By $ ByXPath.findElement (By.java:361) в org.openqa.selenium.remote.RemoteWebDriver .findElement (RemoteWebDriver.java:360) на org.openqa.selenium.support.ui.ExpectedConditions.findElement (ExpectedConditions.java:895) на org.openqa.selenium.support.ui.ExpectedConditions.access $ 000 (ExpectedConditions.java:41) на org.openqa.selenium.support.ui.ExpectedConditions $ 6.apply (ExpectedConditions.java:181) в org.openqa.selenium.support.ui.ExpectedConditions $ 6.apply (ExpectedConditions. java: 178) по адресу org.openqa.selenium.support.ui.FluentWait.until (FluentWait.java:238) at com.gmcs.appiumtest.TutorTest.startTest (TutorTest.java:37) в com.gmcs.appiumtest.Main.main (Main.java:8) в sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 43) в java.lang.reflect.Method.invoke (Method.java:498) в com.intellij.rt.execution.application.AppMain.main (AppMain.Java: 147)

ответ

1

Вы можете попробовать обновить io.appium/Java-клиент баночку 4.0.0

У меня была аналогичная проблема. Я изменил java-клиент с 3.0.1 до 4.0.0, и проблема была решена.

+0

работал для меня. благодаря –

Смежные вопросы