Skip to content

Commit

Permalink
moveto shim to transform ScriptTimeout exception to UnknownError
Browse files Browse the repository at this point in the history
  • Loading branch information
robocoder committed Dec 7, 2023
1 parent b756195 commit 6ca447e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/WebDriver/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace WebDriver;

use WebDriver\Exception as WebDriverException;

/**
* WebDriver\Session class
*
Expand Down Expand Up @@ -292,6 +294,24 @@ public function frame()
return new Frame($this->url . '/frame');
}

/**
* moveto: /session/:sessionId/moveto (POST)
*
* @param array $parameters
*
* @return mixed
*/
public function moveto($parameters)
{
try {
$result = $this->curl('POST', '/moveto', $parameters);
} catch (WebDriverException\ScriptTimeout) {
throw WebDriverException::factory(WebDriverException::UNKNOWN_ERROR);
}

return $result['value'];
}

/**
* timeouts methods: /session/:sessionId/timeouts (POST)
* - $session->timeouts($json) - set timeout for an operation
Expand Down

0 comments on commit 6ca447e

Please sign in to comment.