2

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...

1 Answer 1

2

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());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.