Skip to content

Commit b3af591

Browse files
committed
Selenium client updates
1 parent 59cec8e commit b3af591

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

lib/WebDriver/Exception.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ abstract class Exception extends \Exception
6060
const INVALID_SELECTOR = 32;
6161
const SESSION_NOT_CREATED = 33;
6262
const MOVE_TARGET_OUT_OF_BOUNDS = 34;
63+
const INVALID_XPATH_SELECTOR = 51;
64+
const INVALID_XPATH_SELECTOR_RETURN_TYPER = 52;
65+
const ELEMENT_NOT_INTERACTABLE = 60;
66+
const INVALID_ARGUMENT = 61;
67+
const NO_SUCH_COOKIE = 62;
68+
const UNABLE_TO_CAPTURE_SCREEN = 63;
69+
const ELEMENT_CLICK_INTERCEPTED = 64;
70+
const NO_SUCH_SHADOW_ROOT = 65;
71+
const METHOD_NOT_ALLOWED = 405;
6372

6473
// obsolete
6574
const INDEX_OUT_OF_BOUNDS = 1;
@@ -124,6 +133,15 @@ abstract class Exception extends \Exception
124133
self::UNEXPECTED_PARAMETERS => array('UnexpectedParameters', 'This command does not expect this number of parameters.'),
125134
self::INVALID_REQUEST => array('InvalidRequest', 'This command does not support this HTTP request method.'),
126135
self::UNKNOWN_LOCATOR_STRATEGY => array('UnknownLocatorStrategy', 'This locator strategy is not supported.'),
136+
self::INVALID_XPATH_SELECTOR => array('InvalidSelector', 'Argument was an invalid selector.'),
137+
self::INVALID_XPATH_SELECTOR_RETURN_TYPER => array('InvalidSelector', 'Argument was an invalid selector.'),
138+
self::ELEMENT_NOT_INTERACTABLE => array('ElementNotInteractable', 'A command could not be completed because the element is not pointer- or keyboard interactable.'),
139+
self::INVALID_ARGUMENT => array('InvalidArgument', 'The arguments passed to a command are either invalid or malformed.'),
140+
self::NO_SUCH_COOKIE => array('NoSuchCookie', 'No cookie matching the given path name was found amongst the associated cookies of the current browsing context\'s active document.'),
141+
self::UNABLE_TO_CAPTURE_SCREEN => array('UnableToCaptureScreen', 'A screen capture was made impossible.'),
142+
self::ELEMENT_CLICK_INTERCEPTED => array('ElementClickIntercepted', 'The Element Click command could not be completed because the element receiving the events is obscuring the element that was requested clicked.'),
143+
self::NO_SUCH_SHADOW_ROOT => array('NoSuchShadowRoot', 'The element does not have a shadow root.'),
144+
self::METHOD_NOT_ALLOWED => array('UnsupportedOperation', 'Indicates that a command that should have executed properly cannot be supported for some reason.'),
127145

128146
// @link https://w3c.github.io/webdriver/#errors
129147
'detached shadow root' => array('DetachedShadowRoot', 'A command failed because the referenced shadow root is no longer attached to the DOM.'),

lib/WebDriver/Session.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,10 @@ public function timeouts()
341341
}
342342

343343
if (func_num_args() === 2) {
344-
$arg = $this->legacy
345-
? array(
346-
'type' => func_get_arg(0), // 'script' or 'implicit'
347-
'ms' => func_get_arg(1), // timeout in milliseconds
348-
)
349-
: array(
350-
func_get_arg(0) => func_get_arg(1), // 'script' or 'implicit' => timeout in milliseconds
351-
);
344+
$type = func_get_arg(0); // 'script', 'implicit', or 'pageLoad'
345+
$timeout = func_get_arg(1); // timeout in milliseconds
346+
347+
$arg = $this->legacy ? array('type' => $type, 'ms' => $timeout) : array($type => $timeout);
352348

353349
$this->curl('POST', '/timeouts', $arg);
354350

0 commit comments

Comments
 (0)