skarmani2002 / php-webdriver-bindings

Automatically exported from code.google.com/p/php-webdriver-bindings
0 stars 0 forks source link

Set implicit Wait missing #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to set implicit wait for WebDriver
2.
3.

What is the expected output? What do you see instead?

Able to set implicit wait option for WebDriver

Please provide any additional information below.

Missing feature in current bindings. I've written the code for it but haven't 
extensively tested it out. Attaching it inline with comment below:

/**
     * Set implicit wait timeout for Web Driver
    */
    public function setImplicitWaitTimeout($waitTimeout) {
        $request = $this->requestURL . "/timeouts/implicit_wait";        
        $session = $this->curlInit($request);
        $args = array('ms' => $waitTimeout);
        $jsonData = json_encode($args);
        $this->preparePOST($session, $jsonData);
        curl_exec($session);        
    }

Original issue reported on code.google.com by manga...@gmail.com on 22 Dec 2011 at 12:21

GoogleCodeExporter commented 9 years ago
Forgot to mention, that code patch can go under WebDriver.php.

Original comment by manga...@gmail.com on 22 Dec 2011 at 12:22

GoogleCodeExporter commented 9 years ago
There is timeouts -command defined in wire protocol:
http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/time
outs

So I would suggest to modify WebDriverSession::timeouts() -method:

--clip--
  public function timeouts($timeouts=null) {
    if($timeouts!==null)
      return $this->curl('POST', '/timeouts', $timeouts);

    $item = new WebDriverSimpleItem($this->url . '/timeouts');
    return $item->setMethods(array(
      'async_script' => 'POST',
      'implicit_wait' => 'POST',
    ));
  }
--clip--

Then you can do:
$timeout = 10000;
$browser->timeouts(array('type'=>'implicit', 'ms'=>$timeout));
$browser->timeouts(array('type'=>'page load', 'ms'=>$timeout));
$browser->timeouts(array('type'=>'script', 'ms'=>$timeout));

Original comment by sami.ve...@gmail.com on 19 Jun 2012 at 9:33

GoogleCodeExporter commented 9 years ago
No, sorry but timeout and implicit_wait are two different things...

Original comment by felix.fr...@cloudaid.org on 21 Jun 2012 at 7:45

GoogleCodeExporter commented 9 years ago

Original comment by manga...@gmail.com on 9 Mar 2013 at 6:43

GoogleCodeExporter commented 9 years ago
Comment 2 raises a good point. Per the JSONWireProtocol, implicit wait is 
grouped under timeouts. I missed looking over the comments while I worked on 
the fix. 

And on the other hand, not so tech savvy users might be more comfortable with a 
separate method for setting implicit waits rather than a single method to set 
all types of timeouts.

For now, I've implemented what I originally mentioned in revision 68. We can 
discuss and repatch later as needed.

Original comment by manga...@gmail.com on 9 Jun 2013 at 3:09

GoogleCodeExporter commented 9 years ago
Marking fixed for now as it's now available, later changes can be to optimize 
code/API.

Original comment by manga...@gmail.com on 9 Jun 2013 at 3:10