Android Appium Script failing on AWS Device farm while its working perfectly on local

NOTE: Environment is perfect, able to run the app on AWS Device farm but using Locator Fails on Device Farm…

what frame work you using? I am using testng maven and for that you need to update you POM with all the dependencies along with some more required by AWS. You can get all these details from here:
http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-android-appium-java-testng.html

For further details you can go here:
http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-intro.html

Note: I have noticed that AWS cloud farm sometimes ignors the Testng Anotations. You really need to be careful with what you are using.

Thanks for the suggestion…
Yes i followed the steps of setting up for cloud…
And I am already able to run the script on aws device farm … App runs correctly … What is causing problem is it is not able to locate element…

I get ‘no such element’ exception for most element… Its hybrid app built with cordova…

For some element i had to use android.view.view class only… And content description…

I asked developera to give unique ids to elements i thought this will solve the problem but locating with resource-id also fails…

What will be operative solution for this??

are you trying on the same device/platform on AWS as you used with your local test. Sometimes the network connections on cloud device doesn’t act very nice. You need to validate the screenshots if there is any lag or delay happening. If you have any doubt w.r.t your locators in different frames/Views, you can also try this:
public static int LinearLayoutIndex(By by)
{
List LinLayout = driver.findElements(By.className(“android.widget.LinearLayout”));
int LLcount = LinLayout.size();
int i;
for(i=0; i<LLcount; i++)
{
driver.switchTo().frame(i);
int count=driver.findElements(by).size();

if(count>0)
{
break; } else{ System.out.println("Continue Looping"); } } driver.switchTo().defaultContent(); return i; } But if you are using the same device on your local and it is working fine there, then the above code or any other locator strategy does not matter.

Thank you so much for your help… One more thing i just new about the app under test is its hybrid app built with cordova… And webview is not enabled in it… And developers are facing challenge where to do that as app is built with mostlt html js and css… Currently i am able to see only one context NATIVE_APP… If you can tell how to enable context for debugging weview please tell…

Hi.I’m facing the same issue.

I’m working on Hybrid app.I can run tests on local machine but when i’m uploading the project zip into AWS.i’m not able to run scripts facing error.

I have two questions in my mind
1.How i will run Appium when i’m working with AWS
2.How we can pass excel sheet data into AWS devices

are you using Appium with Testng??
if yes, for AWS you’ll need MAVEN project structure and produce zip by
editing POM.xml of Maven project… I am giving you link to steps for how to
produce Zip for AWS Device farm…

  1. Create maven project according to this >>
    http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-android-appium-java-testng.html
    (if you are using other then TestNG there are options)
  2. How to produce Zip >>
    http://www.tothenew.com/blog/how-to-provide-your-testsscripts-dependencies-to-aws-device-farm/
    ALSO
    http://blog.bimarian.com/my-first-encounter-with-aws-device-farm/

Let me know if you need more help (i will try what I can)

Hi Rohit,

Thanks for your response.

Already,I have done all the steps which is provided in the urls .

Performed the below steps:
I have converted my project in to MAVEN Testng (My App is Hybrid App)

I can able to run scripts on my local machine by using MAVEN(TestNG)

I installed pluggins to zip the framework(In POM.xml i have updated all the
pluggins which is required to zip the framework).

I uploaded my MAVEN TestNg framework into AWS.

When i’m running my scripts on AWS.Scripts are failing.

I observed the following things.

1.Appium is not able to find the elements on my App
2.The App (apk) in not installing on AWS devices
3.AWS is not taking the excel data in the framework

Could you please help me on that.

And also could you please answer my questions below

1.How we can run appium, is it prelaunch or we need to write the code in
framework to run the appium

2.AWS will support Excel sheet or else we need to hard code the data in the
framework

Regards,
Naga lakshmi

When you select “Appium with TestNG” on AWS Device farm… it automatically does everything… you need not to do any setup…

for the Excel sheet stuff I am not sure, havent encountered that issue… (please refer other articles or topic on Stackoverflow)

One main IMP thing is …Do not keep desired capabilities when you obtain Zip of your project for AWS… Comment all capabilities except one for the server i.e. driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

CONSIDERING:

  1. you are using webview correctly…
  2. You are uploading ZIP obtained in your project “Target” folder

Alraedy i did all these things (no Desired capabilities except server).Yes i’m uploading Zip from Target.How can i resolve this issue?Please help

  • Hope you are using correct webview name…
  • Read Java Output and Appium server output log On AWS and try and identify possible cause, if possible also share that log here…

Hi Rohit,
When i’m uploading My Hybrid App on AWS , getting following error.Thanks

SI_WF1_1_OG_DefaultLocation_DefaultCategory
2016-09-15T15:15-0500
SI_WF1_1_OG_DefaultLocation_DefaultCategory failed: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 35.49 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: ‘2.45.0’, revision: ‘5017cb8e7ca8e37638dc3091b2440b90a1d8686f’, time: ‘2015-02-27 09:10:26’ System info: host: ‘ip-172-31-13-65’, ip: ‘172.31.13.65’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.13.0-53-generic’, java.version: ‘1.8.0_65’ Driver info: io.appium.java_client.android.AndroidDriver Capabilities [{networkConnectionEnabled=true, desired={}, platformVersion=4.2.2, warnings={}, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, databaseEnabled=false, deviceName=TS9TWSTSHQEEMV4S, platform=LINUX}] Session ID: 87689b87-5b30-402f-83e7-e3c622691c43 *** Element info: {Using=xpath, value=//*[@id=‘username-input’]}

please try with just minor edit in your script … then reply with what happens…

Increase timeout to more than 60 sec(keep 180 sec for just test) sometimes it takes time on aws server… you have 30 sec timeout I guess…

Also… On test result… you’ll see “Video” in files options … download that video and see what is happening while your app is under test

I’m using page object Model framework in my project so i’m maintaining data(username and password) in Excel sheet.

If i hard code the data into scripts, I can able to run scripts on AWS device farm.But when i’m executing the scripts by using excel data (with out hard code the data into scripts )on AWS i’m getting the following error

“An element could not be located on the page using the given search parameters”

Anyone help me on this?

Thanks in Advance.

I’m blocked with the same issue.

I configured POM according to AWS instructions, I see the app (which is a Cordova Hybrid) launch yet no elements are located.

Has anyone made progress on this?

Interesting side note is the built-in AWS fuzzing test will run but any Appium related commands for locating elements fail repeatedly.

Please advise as increasing timeouts did not help.