Skip to content

Working with mobile devices

daluu edited this page Feb 8, 2012 · 4 revisions

Working with mobile devices

This page is work in progress. This page should describe some steps on how to set up environment to run tests on mobile devices using the PHP driver, extending upon the original Selenium project mobile device driver wiki pages. Please contribute to this if you are using this PHP driver to test on iPhone, iPad, or Android.

References:

http://groups.google.com/group/webdriver/browse_thread/thread/7bf30ea9a2962da2

http://code.google.com/p/selenium/wiki/IPhoneDriver

http://code.google.com/p/selenium/wiki/AndroidDriver

iPhone and iPad

TBD

Android

//start up Android WebDriver server per wiki 1st then...
require './facebook-php-webdriver/__init__.php'; //or however your import of the files goes...
$driver = new WebDriver('http://localhost:8080/wd/hub'); //connect to Android WebDriver server on port 8080
$session = $d->session('android'); //can also pass desired capabilities JSON for more explicit selection, but this is the bare minimum.
$s->open('http://www.yourdomain.com');
$s->element('id','searchText')->clear("");
$s->element('id','searchText')->value(array('value' => str_split("testing 123")));

The following is the desired capabilities object output by Java code for AndroidDriver during execution (against emulator running Android 2.2), useful for reference in constructing your own capabilities object:

{"desiredCapabilities":"Capabilities [{platform=ANDROID, browserName=android, browserConnectionEnabled=true, rotatable=true,takesScreenshot=true, version=}]"}