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)
Related
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
I am automating a hybrid app using Appium, using real mobile device. So my code is written as below:
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.setCapability(CapabilityType.BROWSER_NAME,"Chrome");
capabilities.setCapability("deviceName", "77377f50");
capabilities.setCapability("platformVersion", "9");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("automationName", "uiautomator2");
capabilities.setCapability("autoWebview", "true");
capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));
capabilities.setCapability("appPackage", "com.englishbolo.android.alpha");
capabilities.setCapability("appActivity", "com.englishbolo.android.ui.EnglishBoloSplashScreen filter 36b63470");
capabilities.setCapability(MobileCapabilityType.FULL_RESET,false);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Set <String> contextNames = driver.getContextHandles();
for (String contextName : contextNames)
{
System.out.println("Available Context:"+contextName);
}
driver.context((String) contextNames.toArray()[1]);
driver.findElement(By.xpath("//android.view.View[contains(#resource-id,'en_US')]")).click();
driver.findElement(By.xpath("//android.widget.Button[contains(#resource-id,'OK')]")).click();
driver.findElement(By.xpath("//android.view.View[#text='SIGNUP FREE']")).click();
driver.findElementByClassName("android.widget.Spinner").click();
driver.findElementByXPath("//android.widget.EditText[contains(#resource-id,'userFullName')]").sendKeys("ebuat");
driver.findElementByXPath("//android.view.View[#text='Sri Lanka+94']").click();
driver.findElementByXPath("//android.widget.EditText[contains(#resource-id,'userPhone')]").sendKeys("744693540");
driver.findElementByXPath("//android.widget.EditText[contains(#resource-id,'userPassword')]").sendKeys("1234");
driver.findElementByXPath("//android.widget.EditText[contains(#resource-id,'userMailId')]").sendKeys("ebuatuser_nov18#sharklasers.com");
driver.hideKeyboard();
driver.findElementByXPath("//android.widget.Button[#text='SUBMIT']").click();
driver.findElementByXPath("//android.widget.Button[#text='START NOW']").click();
After this last click action i need to click on radio buttons but after inspecting in appium desktop, only class as a locator is present.
For all radio button class android.view.View is the locator present.
I have used xpath using class name, text * resource-id present. If only classname is present So how can I form xpath to click on radio buttons?
Set <String> contextNames = driver.getContextHandles();
for (String contextName : contextNames)
{
System.out.println("Available Context:"+contextName);
}
driver.context((String) contextNames.toArray()[1]);
Also I have written method getContextHandles to set view to WebView.
Error observed after writing this method:
INFO: HTTP Status: '400' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: No such context found.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'englishhelper-MS-7A15', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-52-generic', java.version: '12.0.1'
Driver info: driver.version: AndroidDriver
remote stacktrace: NoSuchContextError: No such context found.
at AndroidUiautomator2Driver.setContext (/tmp/.mount_AppiumZrt5AD/resources/app/node_modules/appium/node_modules/appium-android-driver/lib/commands/context.js:57:11)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'englishhelper-MS-7A15', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-52-generic', java.version: '12.0.1'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:95)
at appium_new.AppiumSignup.main(AppiumSignup.java:62)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
... 13 more
Caused by: org.openqa.selenium.WebDriverException: No such context found.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'englishhelper-MS-7A15', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-52-generic', java.version: '12.0.1'
Driver info: driver.version: AndroidDriver
remote stacktrace: NoSuchContextError: No such context found.
at AndroidUiautomator2Driver.setContext (/tmp/.mount_AppiumZrt5AD/resources/app/node_modules/appium/node_modules/appium-android-driver/lib/commands/context.js:57:11)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 18 more
Can you please help me with the solutions you may know.
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.
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.
I just try to set up IOS with appium with the IOS provided sample application.
Find my code :
package test2;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
public class AppiumTestB {
private AppiumDriver<IOSElement> driver;
#Test
public void setup() throws MalformedURLException
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformVersion", "9.0");
capabilities.setCapability("deviceName", "iPhone 6");
File app =new File("/Users/uwickdi/Desktop/UICatalog.app");
capabilities.setCapability("app", app.getAbsolutePath());
driver = new IOSDriver<>(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
}
}
i up the appium server and ran test with junit.
Please find the error log.
Anything i missed?
im using client driver 1.5.3(appium version )
java client 4.1.2
using simulator
org.openqa.selenium.WebDriverException: Unable to parse remote response: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities"]
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'SRILAML-N2K0G8W', ip: '2402:4000:bbfd:c4b:c4f0:811d:c8a6:2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_25'
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:353)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
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:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:82)
at test2.AppiumTestB.setup(AppiumTestB.java:29)
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:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
This is the code that i used to run in Simulator.
//CONFIGURING DEVICE CAPABILITIES
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME , "XCUITest");
capabilities.setCapability("platformName",Constant.appPlatform);
capabilities.setCapability("deviceName",Constant.device);
capabilities.setCapability("platformVersion", Constant.version);
capabilities.setCapability("app", app);
//Initiate Driver
driver = new IOSDriver(new URL("http://127.0.0.1:4724/wd/hub"), capabilities);
Hope this helps you. Thanks.