flik
flik

Reputation: 3633

how to run safari with selenium webdriver using php?

I am running an a code and want to use safari for test browser.

<?php
// An example of using php-webdriver.

namespace Facebook\WebDriver;

use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;

require_once('vendor/autoload.php');

// start Firefox with 5 second timeout
$host = 'http://127.0.0.1:4444/wd/hub'; // this is the default

//$capabilities = DesiredCapabilities::firefox();
//$driver = RemoteWebDriver::create($host, $capabilities, 5000);

$driver = RemoteWebDriver::create($host, DesiredCapabilities::chrome());

.....

For now, I am using crome but it is not working good. I do not know what is the way of safari to add for testing...

Upvotes: 2

Views: 323

Answers (1)

Ashfaq
Ashfaq

Reputation: 269

Here is little solution:

Download Safari Driver jar from here: http://central.maven.org/maven2/org/seleniumhq/selenium/selenium-safari-driver/2.43.1/selenium-safari-driver-2.43.1.jar.

Rename the file to a .zip file instead of a .jar file. Unzip it (just double click on it to do so).

In Folder, go to /selenium-safari-driver-2.43.1/org/openqa/selenium/safari. Double click “SafariDriver.safariextz” or simple drag this file in browser.

Then add the line in your code: //Safari driver Settings

$driver = RemoteWebDriver::create($host, DesiredCapabilities::safari());

Upvotes: 2

Related Questions