GMCS Pune
GMCS Pune

Reputation: 83

WebDriverException: No command or response codec has been defined. Appium WebDriver not able to find UIButton

Appium WebDriver not able to find/locate view element(like UIButton) and does not able to click on that element. I am running Appium server using Appium.app on Mac machine.

iOS settings: Basic, Advanced and 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 WARNING: WebDriverException thrown by findElement(By.xpath: //UIAApplication1/UIAWindow1/UIAButton1) org.openqa.selenium.WebDriverException: No command or response codec has been defined. Unable to proceed Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700' System info: host: '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 info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:153) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:368) at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:473) at org.openqa.selenium.By$ByXPath.findElement(By.java:361) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:360) at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:895) at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:41) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:181) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:178) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:238) at com.gmcs.appiumtest.TutorTest.startTest(TutorTest.java:37) at com.gmcs.appiumtest.Main.main(Main.java:8) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Upvotes: 0

Views: 1423

Answers (1)

radiobrain77
radiobrain77

Reputation: 623

You could try updating the io.appium/java-client jar to 4.0.0

I had a similar problem. I changed the java-client from 3.0.1 to 4.0.0 and the problem was solved.

Upvotes: 2

Related Questions