Appium 1.0-beta Java Client

2,934 views
Skip to first unread message

Jonah Stiennon

unread,
Apr 18, 2014, 8:46:53 PM4/18/14
to appium-...@googlegroups.com
Hello everyone,

All of the Appium 1.0 features and endpoints have been implemented in the Appium Java Client!

It depends upon the regular Selenium Java Client, subclassing it to provide an AppiumDriver class.

The project can be found on github: https://github.com/appium/java-client

Im working on getting it published to the Maven Central Repository, but for now the jar is available in the github repo: https://github.com/appium/java-client/tree/master/out/artifacts/java_client

The docs are hosted on github right now too: http://appium.github.io/java-client/


Comment here or on github with any suggestions, issues, bugs, feature requests, etc. And feel free to create pull requests :D

~Jonahss

Jonah Stiennon

unread,
Apr 22, 2014, 4:54:57 PM4/22/14
to appium-...@googlegroups.com
The Appium Java client is now uploaded to the Maven Central Repository!

<dependency>
  <groupId>io.appium</groupId>
  <artifactId>java-client</artifactId>
  <version>1.0</version>
</dependency>

bootstrap online

unread,
Apr 22, 2014, 4:55:27 PM4/22/14
to Jonah Stiennon, appium-...@googlegroups.com
Awesome!
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/d/optout.

hari haran

unread,
Apr 23, 2014, 7:15:08 AM4/23/14
to appium-...@googlegroups.com, Jonah Stiennon
Thats Great... Could u pls suggest how to use it. I have added client jar in  my project. It would be helpful how to  use it. pls suggest.

regards,
hariharan.

Jonah Stiennon

unread,
Apr 23, 2014, 12:47:57 PM4/23/14
to appium-...@googlegroups.com, Jonah Stiennon
You can use it mostly the same way you use the selenium WebDriver (or RemoteWebDriver) classes.

I'm working right now on updating the sample code in appium/sample-code/examples/java to use the new java client. 

In essence, create a new DesiredCapabilities object for the device you are testing.

DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability(CapabilityType.VERSION, "7.1");
        capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
        capabilities.setCapability("device", "iPhone Simulator");
        capabilities.setCapability("app", "absolute/path/to/app");

Then create a new AppiumDriver, passing it the url of your appium server, and the capabilities object

driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);


Now you can find elements through various different methods (xpath, accessibility id, css selector, etc), click on those elements, check their contents, enter text into textfields, create swipe gestures, etc.

Here's an example of a simple test: 


       //first view in UICatalog is a table
        MobileElement table = new MobileElement((RemoteWebElement)driver.findElementByClassName("UIATableView"), driver);
        assertNotNull(table);
        //is number of cells/rows inside table correct
        List<WebElement> rows = table.findElementsByClassName("UIATableCell");
        assertEquals(12, rows.size());
        //is first one about buttons
        assertEquals("Buttons, Various uses of UIButton", rows.get(0).getAttribute("name"));
        //navigationBar is not inside table
        WebElement nav_bar = null;
        try {
            nav_bar = table.findElementByClassName("UIANavigationBar");
        } catch (NoSuchElementException e) {
            //expected
        }
        assertNull(nav_bar);
        //there is nav bar inside the app
        driver.getPageSource();
        nav_bar = driver.findElementByClassName("UIANavigationBar");
        assertNotNull(nav_bar);


Any specific questions, or things you think should be explained better in our documentation?

green...@gmail.com

unread,
Apr 23, 2014, 1:28:51 PM4/23/14
to appium-...@googlegroups.com
Hello, Johan. Sorry for my english.
Thank you very much for such useful library. I try to use your java-client library in my project.  But i have problems, when i try to use some of your API in automation of Android app. For example, shake() method throws exception:

org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 27 milliseconds

I use genymotion VM for Android emulation and i have last version of Appium. Maybe the problem in some VM functionality, and i should try real device?
At the same time some methods, such as currentActivity(), works fine.
Thank you in advance.


Jonah Stiennon

unread,
Apr 24, 2014, 3:10:48 PM4/24/14
to appium-...@googlegroups.com
Hi green...
Your English is excellent, no worries :)

The "shake()" method only works on iOS, not Android. As far as we know, there's no way to simulate an action like that on Android yet.

I've updated the documentation, thanks for pointing it out.

I understand that this was confusing. I'm thinking of making two AppiumDriver classes which inherit from AppiumDriver. Like AppiumIOSDriver and AppiumAndroidDriver. Would you find that useful?

Vinothkumar Velusamy

unread,
Apr 24, 2014, 9:27:10 PM4/24/14
to appium-...@googlegroups.com
Hi Jonah,

At present we are using selenium webdriver 2.40 to initiate the remote web driver. we have scripted many test cases using Appium v0.18.1 and I think we need to again rework on those test cases if we would like to implement Appium 1.0-beta Java Client. 
Is that my understanding is correct.. code below just an example...

WebDriver driver = new RemoteWebDriver(new URL("http://0.0.0.0:1234/wd/hub"),

driver.findElement(By.xpath(elementPath));

Please suggest...

Vinothkumar Velusamy

unread,
Apr 24, 2014, 9:27:11 PM4/24/14
to appium-...@googlegroups.com
Hi Jonah,

At present we are using selenium webdriver 2.40 to initiate the remote web driver. we have scripted many test cases using Appium v0.18.1 and I think we need to again rework on those test cases if we would like to implement Appium 1.0-beta Java Client. 
Is that my understanding is correct.. code below just an example...

WebDriver driver = new RemoteWebDriver(new URL("http://0.0.0.0:1234/wd/hub"),

driver.findElement(By.xpath(elementPath));

Please suggest...


On Thursday, April 24, 2014 12:10:48 PM UTC-7, Jonah Stiennon wrote:

Jonah Stiennon

unread,
Apr 25, 2014, 3:29:14 PM4/25/14
to appium-...@googlegroups.com
Vinothkumar,

Switching to the new Appium 1.0 java client shouldn't take any reworking at all. The AppiumDriver class is a subclass of RemoteWebDriver. So you only gain new features and all you lose is By.TagName because TagName is deprecated in Appium 1.0

So all you need to change is to:

AppiumDriver driver = new AppiumDriver(new URL("http://0.0.0.0:1234/wd/hub"),

driver.findElement(By.xpath(elementPath));

green...@gmail.com

unread,
Apr 28, 2014, 11:37:08 AM4/28/14
to appium-...@googlegroups.com
Hello Jonah. Thank you for the answer. I think it would be useful for to separate API for two classes - IOS and Android.
I have another question now. I need the mechanism to retrieve hint property from password field in my application (like placeholder). Have you any API for resolving such problem in java client?
Example
<TextView  ....>
...
   <android:hint="@string/password_hint">
....
</TextView>
Thank you in advance

четверг, 24 апреля 2014 г., 22:10:48 UTC+3 пользователь Jonah Stiennon написал:

Jonah Stiennon

unread,
Apr 28, 2014, 3:28:50 PM4/28/14
to appium-...@googlegroups.com
Yeah, splitting it into two two classes is on my Todo list. Thank you for your input/advice.

I'm not familiar with the Android hint property, but try these and see if they work:

element.text();

element.getAttribute("hint");

Those have a chance of working. Otherwise, you can suggest the ability to get the hint as a new feature, on the appium github page.

Xiaohong Yuan

unread,
Apr 28, 2014, 6:28:15 PM4/28/14
to appium-...@googlegroups.com
Hi Jonah,

I have moved my test framework  to run against appium 1.0.0-beta.1, the migration has been straight forward, great work on java-client ! 

I run into one issue with AppiumDriver's swipe function where the test swipes a table cell on iPad to reveal some buttons, see attached screen shot:

//swipe from center to left and duration 0.8 sec

driver.swipe(center.x, center.y, 0, center.y, 800);

It seems the duration parameter is not in sync with appium, here is the what the appium log shows:

info: Pushing command to appium work queue: "au.dragApp(487,209,0,209,800)"
debug: Sending command to instruments: au.dragApp(487,209,0,209,800)
info: [INSTSERVER] Sending command to instruments: au.dragApp(487,209,0,209,800)
info: [INST] 2014-04-28 21:25:22 +0000 Debug: target.dragFromToForDuration({x:"487", y:"209"}, {x:"0", y:"209"}, "800")
       
info: [INST] 2014-04-28 21:25:22 +0000 Debug: duration value must be greater than or equal to 0.5 or less than 60
       
info: [INSTSERVER] Socket data received (116 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"duration value must be greater than or equal to 0.5 or less than 60"}

javadoc states:
@param duration amount of time in milliseconds for the entire swipe action to take

Since appium complains the duration format, I tried to put "50" as the swipe duration parameter, but nothing happened when run the test on device, there might be a gap between the AppiumDriver and appium for the swipe to work.

I have the following code as a workaround for the time being:
((JavascriptExecutor)driver).executeScript("UIATarget.localTarget().frontMostApp().mainWindow().images()[0].tableViews()[0].cells()[0].buttons()[\"Decline\"].scrollToVisible();");

It's interesting that the javascript actually was swiping the 3rd table cell not the 1st one as shown in the code, anyone know why this is the case? (I'm also attaching the page source xml).

Thanks,

-xiaohong
before.png
after.png
activity.xml

Jonathan Lipps

unread,
Apr 28, 2014, 6:48:28 PM4/28/14
to Xiaohong Yuan, appium-...@googlegroups.com
I think this is an error in the server side implementation; I noticed the same thing in JS. It appears the duration is getting interpreted as seconds rather than ms.

@imurchie, mind taking a look?

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.
<before.png><after.png><activity.xml>

hari haran

unread,
Apr 28, 2014, 10:47:52 PM4/28/14
to appium-...@googlegroups.com
Jonah... Excellent work by you Many Thanks!!!!

green...@gmail.com

unread,
May 8, 2014, 8:44:07 AM5/8/14
to appium-...@googlegroups.com
Hello, Jonah. 
I have a problem with capturing of screenshot.

AppiumDriver driver = null;
/** driver initialization **/

( (TakesScreenshot) new Augmenter().augment( driver ) ).getScreenshotAs( OutputType.BYTES );

This approach throws next exception:
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:718)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.openqa.selenium.remote.Augmenter.performAugmentation(Augmenter.java:140)
at org.openqa.selenium.remote.Augmenter.create(Augmenter.java:53)
at org.openqa.selenium.remote.BaseAugmenter.augment(BaseAugmenter.java:114)
at com.mobile.AndroidProc.captureScreenshoot(AndroidProc.java:337)
I use java-client-1.1.0.jar
Thank you in advance.

понедельник, 28 апреля 2014 г., 22:28:50 UTC+3 пользователь Jonah Stiennon написал:

Jonah Stiennon

unread,
May 8, 2014, 4:05:23 PM5/8/14
to appium-...@googlegroups.com
Hiya,

Check out the end of this thread

     AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
     String imageEncoded = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);

Ramdas Krishna Baliga

unread,
May 9, 2014, 6:38:43 AM5/9/14
to appium-...@googlegroups.com
Hi Jonah ,
 Great Work!

 Most of the things from previous version are working great with 1.0 using Java client library.

 I am just trying to use AccessibilityId API, but not finding teh way to try it..

 Can you please elaborate what is the use of this API and what property of webelement this maps to?

 I tried using it to clickon button whose label is in strings.xml of app.. but without success.

Thanks,
Ramdas

green...@gmail.com

unread,
May 13, 2014, 3:22:31 PM5/13/14
to appium-...@googlegroups.com
Hello, Jonah. Thank you very much for your advice.
I have a quiestion about using complexFind() method. 
For example, i try to use this code:

 public String scroll_to(String text) {
    text = text.replaceAll("\"", "\\\""); // quotes must be escaped.
    final String[] jsonString = {"\"scroll\"","[[3,\"" + text + "\"]]","[[7,\"" + text + "\"]]"};
    return driver.complexFind(jsonString);
  }
Can you please describe in detail this array {"\"scroll\"","[[3,\"" + text + "\"]]","[[7,\"" + text + "\"]]"}, especially using of "3" and "7" values. Thank you in advance.
четверг, 8 мая 2014 г., 23:05:23 UTC+3 пользователь Jonah Stiennon написал:

bootstrap online

unread,
May 13, 2014, 3:42:19 PM5/13/14
to green...@gmail.com, appium-...@googlegroups.com

Joe Automator

unread,
May 16, 2014, 6:51:56 PM5/16/14
to appium-...@googlegroups.com
Hi,
After adding the dependency into pom.xml, I'm seeing this error in my project.  Any idea?  
The type org.openqa.selenium.ContextAware cannot be resolved. It is indirectly referenced from required .class files
Thanks.

Jonah Stiennon

unread,
May 16, 2014, 7:07:30 PM5/16/14
to Joe Automator, appium-...@googlegroups.com
You should also include the dependency to the regular Selenium Java client.


--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/BIl1eMkLga8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

green...@gmail.com

unread,
May 19, 2014, 8:33:30 AM5/19/14
to appium-...@googlegroups.com, green...@gmail.com
Thank you for information.
Now i try to use complexFind() method, according to example https://github.com/appium/appium/blob/02464c1c6835f1d5616d0050533776ff8e66b662/sample-code/examples/java/junit/src/test/java/com/saucelabs/appium/MobileFindJavaTest.java

private String scroll_to( String text )
    {
text = text.replaceAll( "\"", "\\\"" );
final String[] jsonString = { "\"scroll\"", "[[3,\"" + text + "\"]]", "[[7,\"" + text + "\"]]" };
return driver.complexFind( jsonString );
    }

I get an error and next log from appium server:

> ERROR: debug: Appium request initiated at /wd/hub/session/fd44fdaf-d2f6-4d9b-adec-715cee811dab/appium/app/complex_find
> info: Pushing command to appium work queue: ["find",{"strategy":"dynamic","selector":["\"scroll\"","[[3,\"Signup URL\"]]","[[7,\"Signup URL\"]]"],"context":"","multiple":false}]
> ERROR: debug: Request received with params: {"selector":["\"scroll\"","[[3,\"Signup URL\"]]","[[7,\"Signup URL\"]]"]}
> info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"java.lang.String cannot be cast to org.json.JSONArray"},"sessionId":"fd44fdaf-d2f6-4d9b-adec-715cee811dab"}
> POST /wd/hub/session/fd44fdaf-d2f6-4d9b-adec-715cee811dab/appium/app/complex_find 500 10ms - 250b
> info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"dynamic","selector":["\"scroll\"","[[3,\"Signup URL\"]]","[[7,\"Signup URL\"]]"],"context":"","multiple":false}}
> info: [BOOTSTRAP] [info] Got command of type ACTION
> info: [BOOTSTRAP] [debug] Got command action: find
> info: [BOOTSTRAP] [debug] Finding dynamic.
> info: [BOOTSTRAP] [debug] Returning all? false
> info: [BOOTSTRAP] [debug] Scrolling? false
> info: [BOOTSTRAP] [debug] ["\"scroll\"","[[3,\"Signup URL\"]]","[[7,\"Signup URL\"]]"]
> info: [BOOTSTRAP] [debug] Parsing selector 0
> info: [BOOTSTRAP] [info] Returning result: {"value":"java.lang.String cannot be cast to org.json.JSONArray","status":13}
As i understood, i have incorrect format of array with parameters. 

Thank you in advance.

вторник, 13 мая 2014 г., 22:42:19 UTC+3 пользователь bootstraponline написал:

bootstrap online

unread,
May 19, 2014, 9:42:45 AM5/19/14
to green...@gmail.com, appium-...@googlegroups.com
complexFind is broken for the java-client. I have a fix in a pull request.
https://github.com/appium/java-client/pull/26

hari haran

unread,
May 30, 2014, 5:58:30 AM5/30/14
to appium-...@googlegroups.com, green...@gmail.com
Hi jonah,

Test Requiments:
API 16, ChromeDriver (v2.9.248315), chromeversion: 35.0.1916.138

Case 1:Using Java Client Library

        DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Selendroid");
                capabilities.setCapability("platform", "Windows");
             capabilities.setCapability("app", "chrome");
        
      driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

Result: Nothing happens in node server

FAILED CONFIGURATION: @BeforeClass setUp
java.lang.NoClassDefFoundError: org/openqa/selenium/ContextAware
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at BrowserTesting.setUp(BrowserTesting.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.ContextAware
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 49 more

Case 2:Using Remote web driver  (Note - Device has been connected... adb device fetch the device name)

FAILED CONFIGURATION: @BeforeClass setUp
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 21.21 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'WW930L46555D', ip: '10.193.11.119', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
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:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at BrowserTesting.setUp(BrowserTesting.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

I am struck please suggest.

Regards,
Hariharan.

green...@gmail.com

unread,
May 30, 2014, 7:35:20 AM5/30/14
to appium-...@googlegroups.com, green...@gmail.com
Thank you for your fix of complexFind() method. 
I have a question about scrolTo() mechanism. I use it in my custom getUIElement(String locator), when i get text as locator, i try use scrolling to element with text locator. But in the case, when element with text locator is not present on the page (for example, i check is acknowledgement appear or disappear) scrollTo() method isn't throws Exception (according to javadoc scrollTo(String text) method isn't throws Exception). This method just prints stack trace in console (NullPointerException) so i can't handle and process any exceptions from scrollTo() method.
Thank you in advance.

понедельник, 19 мая 2014 г., 16:42:45 UTC+3 пользователь bootstraponline написал:

Jonah Stiennon

unread,
May 30, 2014, 2:39:37 PM5/30/14
to green...@gmail.com, appium-...@googlegroups.com
@hari haran:

You have to include the regular Selenium jar, because appium-client extends those functions.
Also, check your desired capabilities, they are different for Appium 1.0: https://github.com/appium/appium/blob/master/docs/en/caps.md


You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/BIl1eMkLga8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

Jonah Stiennon

unread,
May 30, 2014, 2:55:08 PM5/30/14
to green...@gmail.com, appium-...@googlegroups.com
@greenwoodg7:

ScrollTo doesn't work on Android. Instead you can use the complexFind() function as a work around until this issue gets resolved.
Here you can find a bit more explanation for complexFind: https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/android/dynamic.rb

green...@gmail.com

unread,
May 30, 2014, 6:47:19 PM5/30/14
to appium-...@googlegroups.com, green...@gmail.com
Thank you for information.
For example i try to use complexFind(). According to your refference:

29 => ['resourceId(String id)', 'SELECTOR_RESOURCE_ID', 29],
So, i use next code:
webdriver().complexFind(String.format("[\\"scroll\\",[[29,\\"%1$s\\"]]]", "some_id"))

This method always returns for me the instance of MobileElement, for any id value (even for non existing ids).
What incorrect with this approach?
Thank you in advance.



пятница, 30 мая 2014 г., 21:55:08 UTC+3 пользователь Jonah Stiennon написал:

P.A

unread,
May 30, 2014, 7:39:01 PM5/30/14
to appium-...@googlegroups.com
I got a 404 on this link https://github.com/appium/java-client/tree/master/out/artifacts/java_client
Would you mind fixing it please?
Thank you!

Jonah Stiennon

unread,
May 30, 2014, 7:43:02 PM5/30/14
to P.A, appium-...@googlegroups.com
Is downloading it directly from the Maven Central Repository ok as an alternative?



--

P.A

unread,
May 30, 2014, 7:48:27 PM5/30/14
to appium-...@googlegroups.com, anhp...@gmail.com
Oh thank you! I didn't see your second post about its availability on maven

bootstrap online

unread,
May 30, 2014, 8:02:07 PM5/30/14
to Jonah Stiennon, green...@gmail.com, appium-...@googlegroups.com
scrollTo()
scrollToExact()
https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/AndroidUIAutomatorTest.java#L50

in the java-client project work fine on Android (they aren't
implemented for iOS). I wrote them. They will scroll to an element
even if it isn't on screen. The implementation is based on
complexFind. With Ruby, an element not found exception is raised when
scrolling to an element that doesn't exist.

I'll check to see if the Java version properly raises an exception
when the element is not found.

hari haran

unread,
Jun 1, 2014, 10:51:06 PM6/1/14
to appium-...@googlegroups.com, jon...@saucelabs.com, green...@gmail.com
@Jonah....
I have added a) Selenium-server 2.39 jars b) Java client jars
 
Below are desired capabilties..... Please suggest am getting error message
 
The type org.openqa.selenium.ContextAware cannot be resolved.It is indirectly referenced from required .class files
 
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability("automationName", "Selendroid");
    capabilities.setCapability("platformVersion", "4.1.1");
    capabilities.setCapability("deviceName", "b412bc74");
    capabilities.setCapability("app", xxxx);
    capabilities.setCapability("appPackage", yyy);
    capabilities.setCapability("appActivity", zzz);

   wdriver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);

Regards,

Hariharan.

 

 
The type org.openqa.selenium.ContextAware cannot be resolved. It is indirectly referenced from required .class files
 
 

bootstrap online

unread,
Jun 1, 2014, 11:01:51 PM6/1/14
to hari haran, appium-...@googlegroups.com, Jonah Stiennon, green...@gmail.com
Use selenium 2.42.1

Naidu A

unread,
Jun 2, 2014, 7:33:42 AM6/2/14
to appium-...@googlegroups.com
is Swipe action for mobile web broken in java-client?
I am getting below error:
Proxied response received with status 404: "unknown command: session/dac5f1400d5fd5c1396e7010be002a6e/touch/perform 

Ольга Люцко

unread,
Jun 2, 2014, 8:46:23 AM6/2/14
to appium-...@googlegroups.com
Hi
Can you help me?
I have appium 1.1.0

Me settings:
 File classpathRoot = new File(System.getProperty("user.dir"));
        File appDir = new File(classpathRoot, "/app");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        File app = new File(appDir, "Uniform.app");
        capabilities.setCapability(CapabilityType.BROWSER_NAME,"");
        capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("device", "iPhone Simulator");
        capabilities.setCapability(CapabilityType.VERSION, "7.1");
try {
            driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

But I can't start session
I have an error

debug: Appium request initiated at /wd/hub/session

debug: Request received with params: {"desiredCapabilities":{"platform":"Mac","app":"/Users/admin/qa_tests/app/Uniform.app","platformName":"iOS","browserName":"","device":"iPhone Simulator","bundleId":"com.cupid.ufd.enterprise","version":"7.1"}}

info: Using local app from desired caps: /Users/admin/qa_tests/app/Uniform.app

info: Creating new appium session dfbfd50f-fed9-49d0-9aff-63f053e4a96d

info: Removing any remaining instruments sockets

info: Cleaned up instruments socket /tmp/instruments_sock

info: Cleaning up any tracedirs

info: No tracedirs to clean up

info: Setting Xcode folder

info: Setting Xcode version

info: Setting iOS SDK Version

info: iOS SDK Version set to 7.1

info: Detecting automation tracetemplate

info: Not auto-detecting udid, running on sim

info: Parsed app Localizable.strings

info: Not setting locale

debug: Creating instruments

info: No iOS / app preferences to set

info: Starting iOS 7.* simulator log capture

info: Killing the simulator process

info: Killing any other simulator daemons

debug: Checking whether instruments supports our device string

info: Getting list of devices instruments supports

info: Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: Cleaning app state.

info: No folders found to remove

debug: No device id or app, not installing to real device.

debug: Starting instruments

info: Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [INSTSERVER] Instruments socket server started at /tmp/instruments_sock

info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1

info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/admin/qa_tests/app/Uniform.app -e UIASCRIPT /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments

info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}

info: And launch timeouts (in ms): {"global":90000}

info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/admin/qa_tests/app/Uniform.app/Uniform).


info: [INST STDERR] Instruments Trace Error : Error Starting Recording


info: [INSTSERVER] Instruments exited with code 253

info: Killall instruments

info: Attempting to retry launching instruments, this is retry #1

info: Killall iPhoneSimulator

info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1

info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/admin/qa_tests/app/Uniform.app -e UIASCRIPT /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments

info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}

info: And launch timeouts (in ms): {"global":90000}

info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/admin/qa_tests/app/Uniform.app/Uniform).


info: [INST STDERR] Instruments Trace Error : Error Starting Recording


info: [INSTSERVER] Instruments exited with code 253

info: Killall instruments

info: Attempting to retry launching instruments, this is retry #2

info: Killall iPhoneSimulator

info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1

info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/admin/qa_tests/app/Uniform.app -e UIASCRIPT /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments

info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}

info: And launch timeouts (in ms): {"global":90000}

info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/admin/qa_tests/app/Uniform.app/Uniform).


info: [INST STDERR] Instruments Trace Error : Error Starting Recording


info: [INSTSERVER] Instruments exited with code 253

info: Killall instruments

info: Attempting to retry launching instruments, this is retry #3

info: Killall iPhoneSimulator

info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1

info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/admin/qa_tests/app/Uniform.app -e UIASCRIPT /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments

info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/usr/local/lib/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}

info: And launch timeouts (in ms): {"global":90000}

info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/admin/qa_tests/app/Uniform.app/Uniform).


info: [INST STDERR] Instruments Trace Error : Error Starting Recording


info: [INSTSERVER] Instruments exited with code 253

info: Killall instruments

error: Instruments crashed on startup

info: Stopping iOS log capture

info: Killing the simulator process

info: Killing any other simulator daemons

info: Cleaning app state.

info: No folders found to remove

info: Cleaning up appium session

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: Error: Instruments crashed on startup

    at Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:398:31)

    at Instruments.launch (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:328:12)

    at ChildProcess.EventEmitter.emit (events.js:91:17)

    at Process._handle.onexit (child_process.js:674:10)

info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}

PO



Help me please!!!!!



Jonah Stiennon

unread,
Jun 2, 2014, 12:39:34 PM6/2/14
to Ольга Люцко, appium-...@googlegroups.com
Naidu: I don't think the .swipe() function is broken, but I may be wrong. Can you provide more information?

Blagko.olga: did you create an issue on github? There's a copy of your issue there right now.


--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/BIl1eMkLga8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

Isaac Murchie

unread,
Jun 2, 2014, 12:41:28 PM6/2/14
to Ольга Люцко, appium-...@googlegroups.com
Please don't hijack other threads. 


On Mon, Jun 2, 2014 at 5:46 AM, Ольга Люцко <blagk...@gmail.com> wrote:

Jonah Stiennon

unread,
Jun 2, 2014, 12:47:26 PM6/2/14
to Isaac Murchie, Ольга Люцко, appium-...@googlegroups.com
Really, this thread was the announcement for the release of java-client. All java-client questions, issues, and comments should be posted as separate issues, or submit an issue to the github repository.


--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/BIl1eMkLga8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.

Pooja Shah

unread,
Jun 6, 2014, 2:51:44 AM6/6/14
to appium-...@googlegroups.com
Hi Jonah,

Thanks for sharing it (I was thinking to write similar and eventually figured out its already a solved problem ;-) , let me know if any extension is required, I would be happy to support) 
Though jar link looks like moved to some other location - https://github.com/appium/java-client/tree/master/out/artifacts/java_client - shows 404 error
It would be great if you can share the updated location.

Thanks,
Pooja

bootstrap online

unread,
Jun 6, 2014, 9:03:20 AM6/6/14
to Pooja Shah, appium-...@googlegroups.com

Pooja Shah

unread,
Jun 6, 2014, 10:35:30 AM6/6/14
to bootstrap online, appium-...@googlegroups.com
Thanks bootstrap for sharing this quick link for all the jars :-)

Thanks,
Pooja

Pooja Shah

unread,
Jun 10, 2014, 8:52:21 AM6/10/14
to appium-...@googlegroups.com, poojas...@gmail.com
Hi boostraponline & Jonah,

hideKeyboard for IOS app doenst work, it rather clicks on prev button  (i assume, it is blindling trying to tap on left most button and in mine, the "done" is @ rightmost place, checkout screenshot)
 If you can help me understand how
"postC("/session/:sessionId/appium/device/hide_keyboard")" works (some hint like which class of appium src it goes) then I might resolve this issue in the library.

Regards,
Pooja
iOS Simulator Screen shot 10-Jun-2014 6.21.48 pm.png

bootstrap online

unread,
Jun 10, 2014, 9:22:57 AM6/10/14
to Pooja Shah, appium-...@googlegroups.com
It's broken on iOS due to a known issue.
https://github.com/appium/appium/issues/2369
Reply all
Reply to author
Forward
0 new messages