MinkSelenium2Driver icon indicating copy to clipboard operation
MinkSelenium2Driver copied to clipboard

setTimeouts setting does not take effect

Open rdpanek opened this issue 11 years ago • 11 comments

Hi, I have step in my context:

  /**
   * @Then /^I see the name "([^"]*)" of the logged in user$/
   */
  public function iSeeTheNameOfTheLoggedInUser($arg1)
  {
    $this->gui->getSession()->getDriver()->setTimeouts(array('implicit'=>10000));
    $this->gui->assertPageContainsText($arg1);
  }

in seleniumRC log:

10:24:22.836 INFO - Executing: [implicit wait: 10000] at URL: /session/0d08ff35-0283-4e90-9379-3d94baf71fd5/timeouts)
10:24:22.842 INFO - Done: /session/0d08ff35-0283-4e90-9379-3d94baf71fd5/timeouts
10:24:22.843 INFO - Executing: [find element: By.xpath: //html] at URL: /session/0d08ff35-0283-4e90-9379-3d94baf71fd5/element)
10:24:22.850 INFO - Done: /session/0d08ff35-0283-4e90-9379-3d94baf71fd5/element

but does not affect the setting timeouts.

10s timeout does not apply - does not expect to find an element in next method. What I doing wrong?

Thanks

rdpanek avatar Feb 27 '14 09:02 rdpanek

The setTimeouts functionality was only developed for Selenium2Driver. If you're saying that you have seleniumRC log then you're using SeleniumDriver, aren't you?

The tests for setTimeouts method pass, are you sure that you're setting the right timeout to the right value?

aik099 avatar Feb 27 '14 09:02 aik099

In composer.json

"behat/mink-selenium2-driver": "1.2.*@dev"

my behat.yml

MinkExtension-local: &MinkExtension-local
  default_session: selenium2
  selenium2:
    wd_host: http://localhost:4444/wd/hub

rdpanek avatar Feb 27 '14 09:02 rdpanek

and I don't understand your last sentence.

rdpanek avatar Feb 27 '14 09:02 rdpanek

You're saying that setTimeouts call doesn't actually set any timeouts on Selenium side. I'm just saying that this can't be true, because in the driver test suite we're verifing that: https://github.com/Behat/MinkSelenium2Driver/blob/467b6e4208897817774c9bd74e42e517a0a5142e/tests/Behat/Mink/Driver/Selenium2DriverTest.php#L95

aik099 avatar Feb 27 '14 09:02 aik099

Yes, I passed your tests and the whole history of issues - I'm just saying that there is some problem (implementation / version of selenium server) I do not know, but I finding solutions. thx

rdpanek avatar Feb 27 '14 10:02 rdpanek

Just dumb guess, but maybe the element you're expecting would appear within 10 seconds isn't appearing?

If you can arrange minimal HTML/JS piece of code where you can replicate the problem then I can better assist you in solving it.

aik099 avatar Feb 27 '14 10:02 aik099

yes, that's a problem. But I think I'm on the way to a solution.

But if I want to use 'page' => 4000 to wait for the upload page, I get an error of selenium

11:16:10.295 INFO - Executing: [page wait: 10000] at URL: /session/48c162e7-6385-4778-8e53-b0080dd6c6dd/timeouts)
11:16:10.516 WARN - Exception thrown
org.openqa.selenium.WebDriverException: Unknown wait type: page
Build info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:54:28'

in code:

$this->gui->getSession()->getDriver()->setTimeouts(array('page'=>10000));

https://github.com/Behat/MinkSelenium2Driver/pull/98 I do not understand how to properly use it?

rdpanek avatar Feb 27 '14 10:02 rdpanek

I found a solution, the correct value is "page load" not "page" https://code.google.com/p/selenium/wiki/JsonWireProtocol # POST_ / session /: sessionId / timeouts

rdpanek avatar Feb 27 '14 10:02 rdpanek

https://github.com/Behat/MinkSelenium2Driver/issues/122#issuecomment-36229739

So, what was the original problem:

  1. element doesn't appear after page is loaded
  2. element appears after some AJAX-based action after the page is loaded

If test server (where page is located) is slow then using page load timeout might be the solution. Otherwise I recommend using explicit timeout to force Selenium to try locating elements for N amount of milliseconds before giving up immediately as it does now.

Feel free to close the issue if it has been resolved.

aik099 avatar Apr 14 '14 09:04 aik099

Hi, Do you know which Exception does getDriver()->setTimeouts(array('page'=>10000)); throw??

suswari avatar Jun 07 '18 15:06 suswari

@suswari because it should be pageLoad, see comment from https://github.com/minkphp/MinkSelenium2Driver/issues/122#issuecomment-36230907

oleg-andreyev avatar Jan 05 '19 22:01 oleg-andreyev