iOS Device Control Using Appium

2,383 views
Skip to first unread message

Bhaskar Uday

unread,
Nov 5, 2013, 5:41:22 AM11/5/13
to appium-...@googlegroups.com
Hi

Could you please help to resolve the issue with Appium , I am using selenium web driver with Java

How to click on the iOS Simulator/Device Home button or Volume up/Volume down using Selenium webdriver -Java 

Regards
Ubmobile.it

Dan Cuellar

unread,
Nov 5, 2013, 10:48:54 AM11/5/13
to appium-...@googlegroups.com
Home button is not currently allowed in UIAutomation (the API we use to automate iOS) as for volume up and down you'll have to call selenium's execute_script with the raw UIAutomation javascript to do this. I think it's something like "taget.clickVolumeUp()" 

Jonathan Lipps

unread,
Nov 5, 2013, 1:02:22 PM11/5/13
to Bhaskar Uday, appium-...@googlegroups.com
You can't click the home button as it would end your test.

You can however background your app momentarily using "mobile: background".

We haven't implemented volume up/down yet.

--
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/groups/opt_out.

ubmobile.it

unread,
Nov 6, 2013, 4:04:39 AM11/6/13
to appium-...@googlegroups.com, Bhaskar Uday
Thank You Very Much Jonathan!

But still i am facing the issues, my code is below (Java)

JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("mobile:background",6); [my application should wait for 6 seconds in back ground]

is brining application to foreground possible?

js.executeScript("mobile:foreground") , 

Correct me if i am wrong!!

ubmobile.it

unread,
Nov 6, 2013, 4:35:22 AM11/6/13
to appium-...@googlegroups.com
Thanks Jonathan/Dan
I got it !!!, i could able to send my iOS app to background using mobile:background. BUT at the same time i can't perform any operations on iOS device features like settings-> turn off wi-fi

My Scenario is like this:

1. In my iOS application, I need to press a button 
2. I need to send my application to back ground for some time (say 10 sec)
3. By that time I need to change the iOS device settings-> like i need to turnoff wi-fi
4. When my application resumes from back ground, the application should be running without wi-fi


Is this scenario Possible, Please help!!!!!!!!!!!!!!

Dan Cuellar

unread,
Nov 6, 2013, 11:13:17 AM11/6/13
to appium-...@googlegroups.com
Can you use the swipe up menu on iOS7 to set airplane mode?

Jonathan Lipps

unread,
Nov 6, 2013, 2:30:23 PM11/6/13
to ubmobile.it, appium-...@googlegroups.com
it'll come back automatically after that time

z74

unread,
Jan 10, 2014, 5:14:57 PM1/10/14
to appium-...@googlegroups.com, ubmobile.it
Hi Jonathan, 

Does anybody have tried this on real iOS device?  For me, it successfully background the app but failed to foreground it after the given duration.  It works fine on simulator.  Is there other option for real device?

note: I can see the device brings up the background running app after the given duration but the app does not foreground.  From simulator, it will foreground immediately when it show from the background apps.
Message has been deleted

vinu.sl...@gmail.com

unread,
Mar 25, 2014, 3:50:29 AM3/25/14
to appium-...@googlegroups.com, Bhaskar Uday
Hi ubmobile.it,
Did the java code work for you on a real device ??

Im trying 

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("mobile:background",6);

and eclipse is returning the following error :-

org.openqa.selenium.WebDriverException: An error occurred while executing user supplied JavaScript. (WARNING: The server did not provide any stacktrace information)

Please can you tell me what worked for you??

ubmobile.it

unread,
Mar 26, 2014, 11:52:19 AM3/26/14
to appium-...@googlegroups.com, Bhaskar Uday
Could You please try with below code, it works. Please Let me know once it works for you.

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("UIATarget.localTarget().deactivateAppForDuration(50)");


Regards
Uday Bhaskar Donda
Reply all
Reply to author
Forward
0 new messages