Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wedriver pageload timeout #3874

Merged
merged 3 commits into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/modules/WebDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ you should use a tunnel application provided by a service.
* `capabilities` - Sets Selenium2 [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities). Should be a key-value array.
* `connection_timeout` - timeout for opening a connection to remote selenium server (30 seconds by default).
* `request_timeout` - timeout for a request to return something from remote selenium server (30 seconds by default).
* `pageload_timeout` - amount of time to wait for a page load to complete before throwing an error (default 0 seconds).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange but in default is null in this case. A bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's 0 (wait forever) for phantomjs (it seems like so) , though spec says
https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-page-load-timeout

Unless stated otherwise it is 300,000 milliseconds.

so it implemented in way if value doesn't set by user then used default from underling layer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I got it. Thanks

* `http_proxy` - sets http proxy server url for testing a remote server.
* `http_proxy_port` - sets http proxy server port
* `debug_log_entries` - how many selenium entries to print with `debugWebDriverLogs` or on fail (15 by default).
Expand Down
5 changes: 5 additions & 0 deletions src/Codeception/Module/WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
* * `capabilities` - Sets Selenium2 [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities). Should be a key-value array.
* * `connection_timeout` - timeout for opening a connection to remote selenium server (30 seconds by default).
* * `request_timeout` - timeout for a request to return something from remote selenium server (30 seconds by default).
* * `pageload_timeout` - amount of time to wait for a page load to complete before throwing an error (default 0 seconds).
* * `http_proxy` - sets http proxy server url for testing a remote server.
* * `http_proxy_port` - sets http proxy server port
* * `debug_log_entries` - how many selenium entries to print with `debugWebDriverLogs` or on fail (15 by default).
Expand Down Expand Up @@ -258,6 +259,7 @@ class WebDriver extends CodeceptionModule implements
'capabilities' => [],
'connection_timeout' => null,
'request_timeout' => null,
'pageload_timeout' => null,
'http_proxy' => null,
'http_proxy_port' => null,
'ssl_proxy' => null,
Expand Down Expand Up @@ -1192,6 +1194,9 @@ public function _initializeSession()
);
$this->sessions[] = $this->_backupSession();
$this->webDriver->manage()->timeouts()->implicitlyWait($this->config['wait']);
if (!is_null($this->config['pageload_timeout'])) {
$this->webDriver->manage()->timeouts()->pageLoadTimeout($this->config['pageload_timeout']);
}
$this->initialWindowSize();
} catch (WebDriverCurlException $e) {
throw new ConnectionException("Can't connect to Webdriver at {$this->wd_host}. Please make sure that Selenium Server or PhantomJS is running.");
Expand Down