Skip to content

Commit 6ca447e

Browse files
committed
moveto shim to transform ScriptTimeout exception to UnknownError
1 parent b756195 commit 6ca447e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: lib/WebDriver/Session.php

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
namespace WebDriver;
2424

25+
use WebDriver\Exception as WebDriverException;
26+
2527
/**
2628
* WebDriver\Session class
2729
*
@@ -292,6 +294,24 @@ public function frame()
292294
return new Frame($this->url . '/frame');
293295
}
294296

297+
/**
298+
* moveto: /session/:sessionId/moveto (POST)
299+
*
300+
* @param array $parameters
301+
*
302+
* @return mixed
303+
*/
304+
public function moveto($parameters)
305+
{
306+
try {
307+
$result = $this->curl('POST', '/moveto', $parameters);
308+
} catch (WebDriverException\ScriptTimeout) {
309+
throw WebDriverException::factory(WebDriverException::UNKNOWN_ERROR);
310+
}
311+
312+
return $result['value'];
313+
}
314+
295315
/**
296316
* timeouts methods: /session/:sessionId/timeouts (POST)
297317
* - $session->timeouts($json) - set timeout for an operation

0 commit comments

Comments
 (0)