-
Notifications
You must be signed in to change notification settings - Fork 62
Launching browsers
daluu edited this page Dec 29, 2011
·
9 revisions
$web_driver = new WebDriver();
$session = $web_driver->session('htmlunit', array('javascriptEnabled' => true, 'version' => '3.6'));
$web_driver = new WebDriver();
$session = $web_driver->session('firefox');
//can also pass desired capabilities array like with HTMLUnit
//see notes below for full details
$web_driver = new WebDriver();
$session = $web_driver->session('firefox', array('firefox_profile' => file_get_contents("pathTo\Base64EncodedZipFileOfFirefoxProfile.txt")));
//can also pass additional desired capabilities above
You can specify a Firefox profile by doing the following steps:
- Archive the Firefox profile directory into a zip file
- Base 64 encode the zip file and save that output somewhere (can be stored as text file, etc.)
- Read in the base64 encoded data from file into memory and pass that as part of desired capabilities to WebDriver
- Someone else or myself can later update this wiki to provide optimal PHP code to do steps 1-2. Step 3 covered already.
Profile does not need to exist at target machine, as we basically upload profile from client to the server to use.
References:
http://stackoverflow.com/questions/7328494/selenium2-firefox-use-the-default-profile
$web_driver = new WebDriver();
$session = $web_driver->session('internet explorer');
//can also pass desired capabilities array like with HTMLUnit