Skip to content

Commit

Permalink
Merge pull request #358 from OndraM/feature/clarify-url-variable
Browse files Browse the repository at this point in the history
Clarify meaning of selenium server URL variable of RemoteWebDriver
  • Loading branch information
OndraM committed Nov 3, 2016
2 parents f1b9d8d + e9d0e39 commit a3ce27d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lib/Chrome/ChromeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function startSession(DesiredCapabilities $desired_capabilities)
* @throws WebDriverException
*/
public static function create(
$url = 'http://localhost:4444/wd/hub',
$selenium_server_url = 'http://localhost:4444/wd/hub',
$desired_capabilities = null,
$connection_timeout_in_ms = null,
$request_timeout_in_ms = null,
Expand All @@ -73,14 +73,14 @@ public static function create(
* Always throws an exception. Use ChromeDriver::start() instead.
*
* @param string $session_id The existing session id
* @param string $url The url of the remote server
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
*
* @throws WebDriverException
* @return RemoteWebDriver|void
*/
public static function createBySessionID(
$session_id,
$url = 'http://localhost:4444/wd/hub'
$selenium_server_url = 'http://localhost:4444/wd/hub'
) {
throw new WebDriverException('Please use ChromeDriver::start() instead.');
}
Expand Down
20 changes: 10 additions & 10 deletions lib/Remote/RemoteWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function __construct()
/**
* Construct the RemoteWebDriver by a desired capabilities.
*
* @param string $url The url of the remote server
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
* @param DesiredCapabilities|array $desired_capabilities The desired capabilities
* @param int|null $connection_timeout_in_ms
* @param int|null $request_timeout_in_ms
Expand All @@ -68,22 +68,22 @@ protected function __construct()
* @return RemoteWebDriver
*/
public static function create(
$url = 'http://localhost:4444/wd/hub',
$selenium_server_url = 'http://localhost:4444/wd/hub',
$desired_capabilities = null,
$connection_timeout_in_ms = null,
$request_timeout_in_ms = null,
$http_proxy = null,
$http_proxy_port = null
) {
$url = preg_replace('#/+$#', '', $url);
$selenium_server_url = preg_replace('#/+$#', '', $selenium_server_url);

// Passing DesiredCapabilities as $desired_capabilities is encouraged but
// array is also accepted for legacy reason.
if ($desired_capabilities instanceof DesiredCapabilities) {
$desired_capabilities = $desired_capabilities->toArray();
}

$executor = new HttpCommandExecutor($url, $http_proxy, $http_proxy_port);
$executor = new HttpCommandExecutor($selenium_server_url, $http_proxy, $http_proxy_port);
if ($connection_timeout_in_ms !== null) {
$executor->setConnectionTimeout($connection_timeout_in_ms);
}
Expand Down Expand Up @@ -113,15 +113,15 @@ public static function create(
* browser for the whole test suite. You do not have to pass the desired
* capabilities because the session was created before.
*
* @param string $url The url of the remote server
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
* @param string $session_id The existing session id
* @return RemoteWebDriver
*/
public static function createBySessionID($session_id, $url = 'http://localhost:4444/wd/hub')
public static function createBySessionID($session_id, $selenium_server_url = 'http://localhost:4444/wd/hub')
{
$driver = new static();
$driver->setSessionID($session_id)
->setCommandExecutor(new HttpCommandExecutor($url));
->setCommandExecutor(new HttpCommandExecutor($selenium_server_url));

return $driver;
}
Expand Down Expand Up @@ -514,13 +514,13 @@ public function getSessionID()
/**
* Get all selenium sessions.
*
* @param string $url The url of the remote server
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
* @param int $timeout_in_ms
* @return array
*/
public static function getAllSessions($url = 'http://localhost:4444/wd/hub', $timeout_in_ms = 30000)
public static function getAllSessions($selenium_server_url = 'http://localhost:4444/wd/hub', $timeout_in_ms = 30000)
{
$executor = new HttpCommandExecutor($url);
$executor = new HttpCommandExecutor($selenium_server_url);
$executor->setConnectionTimeout($timeout_in_ms);

$command = new WebDriverCommand(
Expand Down

0 comments on commit a3ce27d

Please sign in to comment.