Error while running Appium script to start Calculator application - appium

I am new to Appium and just started with my first test script to start calculator app. I am using Appium version 1.17.0 and Java version 8.
Below is my code:
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
public class AppTest1
{
static AppiumDriver<MobileElement> driver;
public static void main(String[] args) {
try
{
openCalculator();
}
catch (Exception e)
{ // TODO Auto-generated catch
e.printStackTrace();
}
}
public static void openCalculator() throws Exception
{
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "Galaxy M30S");
cap.setCapability("udid", "RZ8N10BC9CT");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "10");
cap.setCapability("appPackage", "com.sec.android.app.popupcalculator");
cap.setCapability("appActivity", "com.sec.android.app.popupcalculator.calculator");
cap.setCapability("automationName", "UiAutomator2");
URL url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver<MobileElement>(url,cap);
System.out.println("My First Appium Test script for Calculator is running..");
}
}
And I am getting this error: Please help as I am trying different google solutions but nothing is working out and stuck in this since last 5 days :(
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-TN4V3G6', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202'
Logcat is uploaded here.
Detailed log file AppiumTestscript Error.doc is uploaded here

Related

com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to org.openqa.selenium.WebElement

I have the following code:
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class SampleSauceCheckBoxTest {
public static final String URL = "http://127.0.0.1:4723/wd/hub";
public static AndroidDriver driver = null;
public static void main(String[] args) throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "\\Users\\jsun\\Downloads\\app-debug.apk");
driver = new AndroidDriver<>(new URL(URL), capabilities);
/**
* Test Actions here...
*/
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
MobileElement mbeLogin = (MobileElement)driver.findElementByXPath("//android.widget.Button[#content-desc='Log In']");
mbeLogin.click();
//driver.quit();
}
}
Here is the output:
C:\dev\java\jdk1.8.0_181\bin\java.exe "-javaagent:C:\Program
Files\JetBrains\IntelliJ IDEA Community Edition
2018.2.4\lib\idea_rt.jar=57587:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.4\bin" -Dfile.encoding=UTF-8 -classpath
C:\dev\java\jdk1.8.0_181\jre\lib\charsets.jar;C:\dev\java\jdk1.8.0_181\jre\lib\deploy.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\dev\java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\dev\java\jdk1.8.0_181\jre\lib\javaws.jar;C:\dev\java\jdk1.8.0_181\jre\lib\jce.jar;C:\dev\java\jdk1.8.0_181\jre\lib\jfr.jar;C:\dev\java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\dev\java\jdk1.8.0_181\jre\lib\jsse.jar;C:\dev\java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\dev\java\jdk1.8.0_181\jre\lib\plugin.jar;C:\dev\java\jdk1.8.0_181\jre\lib\resources.jar;C:\dev\java\jdk1.8.0_181\jre\lib\rt.jar;C:\work\SauceLabsTest\out\production\SauceLabsTest;C:\work\SauceLabsTest\lib\refined\java-client-3.4.0.jar;C:\work\SauceLabsTest\lib\refined\selenium-server-standalone-3.4.0.jar
SampleSauceCheckBoxTest Nov 21, 2018 2:40:07 PM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: W3C Exception in thread "main"
org.openqa.selenium.WebDriverException: Returned value cannot be
converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1} Build
info: version: '3.4.0', revision: 'unknown', time: 'unknown' System
info: host: 'L5480X2M2S5M2', ip: '10.166.43.162', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:417)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
at
io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:132)
at
io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at
io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at SampleSauceCheckBoxTest.main(SampleSauceCheckBoxTest.java:34)
Caused by: java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:415)
... 5 more
Process finished with exit code 1
The code worked fine before, so that's not the problems about appium/selenium versions compatibility.
From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,
AndroidDriver <MobileElement> driver = null;
Also remove casting to MobileElement done while finding the element.
Edit:
Also make sure to use latest Appium Java client and Selenium.

getting error "INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling

Using code for opening Amazon application through Appium. But getting error INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling". How can i solve it. I'm using Appium version 1.4.16.1 & Android 7.0 moto G4 plus as device.
package amazonApp;
import io.appium.java_client.android.AndroidDriver;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class App {
private static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/App/Amazon/");
File app = new File(appDir, "amazon-india-online-shopping-12-2-0-300.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "ZY2239N792");
capabilities.setCapability("platformVersion", "7.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "in.amazon.mShop.android.shopping");
capabilities.setCapability("appActivity", "com.amazon.mShop.home.HomeActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.findElementByName("Skip sign in").click();
System.out.println("hii");
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(10000);
driver.quit();
}
}
I'm getting error:-
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed:
C:\Windows\system32\cmd.exe /s /c "C:\Users\nik\AppData\Local\Android\sdk\platform-tools\adb.exe -s ZY2239N792 install
"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
Failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk:
Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 31.43 seconds
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'nik-nik', ip: '192.168.84.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:39)
at amazonApp.App.main(App.java:31)
You should first remove Amazon app from device or you should change your desired capabilities to use the app installed on device already.

App is not launched in iPad with Appium

I am new to both Appium and iOS and unable to get my app to launch with Appium on my iPad
I am trying to launch an app that is already installed on my iPad and click a button located in the app. When I run this test no app is ever launched and not sure what I am missing.
My setup:
iPad: 10.2
Appium: 1.6
XCode: 8.2.1
I only have an .ipa file for my testing
Here is my code I am trying out. I am assuming XCUITest is required with my setup versions.
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.ios.IOSDriver;
public class iOSTest {
#Test
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "My iPad");
capabilities.setCapability("udid", "UID_CODE");
capabilities.setCapability("platformVersioin", "10.2");
capabilities.setCapability("bundleId", "com.bundle.id");
capabilities.setCapability("app", "--ipa /Users/me/Desktop/MyIpaFile.ipa");
capabilities.setCapability("automationName", "XCUITest");
IOSDriver driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
}
Here is the error I am getting when running in Eclipse:
[TestNG] Running:
/private/var/folders/1v/z4bcsphn11n38cs5hdnq7zkc7gwjdl/T/testng-eclipse-2119368657/testng-customsuite.xml
Jan 26, 2017 3:11:17 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Jan 26, 2017 3:11:18 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Jan 26, 2017 3:11:18 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
FAILED: setUp
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=--ipa /Users/me/Desktop/MyIpaFile.ipa, platformVersioin=10.2, bundleId=com.bundle.id, automationName=XCUITest, udid=UID_CODE, platformName=iOS, deviceName=My iPad}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'myMachine.local', ip: '10.45.4.216', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_92'
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:132)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:82)
at POC.iOSTest.setUp(iOSTest.java:24)
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 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)

Failed to start an Appium session, err was: Error: 'java -version' failed

Hey guys so I've basically done what needs to be done to get appium up and going.
Installed JDK 1.8 (latest version)
Installed Android SDK
Updated environment variables
installed appium 1.4 (Latest ver)
Installed Eclipse and create a new java project after connecting my phone to my pc.
I imported the .apk file to the project and when I set the desired capabilites. I do not have any errors in my code. After launching appium, I run my code and I get the following error:
Starting Node Server
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"C:\Users\svaradar\workspace\LiftMasterAndroidApp\LM_APK\LiftMaster.apk","appPackage":"com.chamberlain.myq.chamberlain","appActivity":"com.chamberlain.myq.activity.LoginActivity","browserName":"","platformName":"Android","version":"5.0","deviceName":"e6feb2e2"}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_51)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: [debug] Using local app from desired caps: C:\Users\svaradar\workspace\LiftMasterAndroidApp\LM_APK\LiftMaster.apk
info: [debug] Creating new appium session 27b1f84e-556e-4881-8afc-d9ea50941f12
error: Failed to start an Appium session, err was: Error: 'java -version' failed. Error: spawn ENOENT
info: Starting android appium
info: [debug] Getting Java version
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: 'java -version' failed. Error: spawn ENOENT
at [object Object]. (C:\Users\svaradar\Desktop\Automation\Appium\node_modules\appium\lib\devices\android\android-common.js:1057:17)
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)","origValue":"'java -version' failed. Error: spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 17.573 ms - 208
Here is my code:
package LiftMasterLaunch;
import java.net.MalformedURLException;
import java.net.URL;
import java.io.File;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.junit.*;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class openApp {
#SuppressWarnings("rawtypes")
private AppiumDriver driver;
#SuppressWarnings("rawtypes")
#Before
public void setUp() throws Exception{
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/LM_APK" );
File app = new File(appDir, "LiftMaster.apk" );
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName","Android");
capabilities.setCapability(CapabilityType.VERSION, "5.0");
capabilities.setCapability("deviceName", "e6feb2e2");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.chamberlain.myq.chamberlain");
capabilities.setCapability("appActivity", "com.chamberlain.myq.activity.LoginActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
#Test
public void testApp() throws Exception {
driver.findElement(By.xpath(("//android.widget.EditText[#text='Account Email']"))).sendKeys("Swaroopvaradarajan#gmail.com");
}
#After
public void tearDown() throws Exception {
driver.quit();
}
}
In my case the solution was setting java in PATH before the Appium and Android paths.
I fixed this issue and am updating this in case someone else runs into this.
All I had to do was add "%SystemRoot%\system32" for Path underneath my system variables. That fixed the problem.

Error when running Appium driver : Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/HttpVerb

I am trying to automate my app using appium simulator. I have done the Appium setup.
When I Run the sample program attached below.
Java program terminated after launching the iphone simulator with the below error
Please help me if I am missing any .JAR file?
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/HttpVerb
at io.appium.java_client.AppiumDriver.postC(AppiumDriver.java:644)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:51)
at myFirstappium.main(myFirstappium.java:21)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.HttpVerb
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
import io.appium.java_client.AppiumDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class myFirstappium {
public static void main(String[] args) {
try{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "8.3");
capabilities.setCapability("deviceName", "iPhone 6");
capabilities.setCapability("app", "/Users/Gan/TEST_UAT.app");
URL serverAddress = new URL("http://127.0.0.1:4723/wd/hub");
WebDriver wd = new AppiumDriver(serverAddress, capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
wd.findElement(By.name("Sign in")).click();
wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIATextField[1]")).sendKeys("test");
wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIASecureTextField[1]")).sendKeys("ok");
wd.close();
}
catch (Exception e)
{
System.out.println (e);
}
}
}
This class has been deprecated for more that a year, and recently it was deleted:
https://github.com/SeleniumHQ/selenium/commit/46d425d3a5fa8e21cf955d7b41bf436548e4971d
This change is included in Selenium version 2.46.
That implies that Appium version you use is not compatible with Selenium 2.46
I faced the same Issue in working with Android. But when I changed the AppiumDriver to RemoteWebdriver the issue got fixed.

Resources