Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTimeouts setting does not take effect #122

Open
rdpanek opened this issue Feb 27, 2014 · 11 comments
Open

setTimeouts setting does not take effect #122

rdpanek opened this issue Feb 27, 2014 · 11 comments

Comments

@rdpanek
Copy link

rdpanek commented Feb 27, 2014

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

@aik099
Copy link
Member

aik099 commented Feb 27, 2014

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?

@rdpanek
Copy link
Author

rdpanek commented Feb 27, 2014

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
Copy link
Author

rdpanek commented Feb 27, 2014

and I don't understand your last sentence.

@aik099
Copy link
Member

aik099 commented Feb 27, 2014

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

@rdpanek
Copy link
Author

rdpanek commented Feb 27, 2014

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

@aik099
Copy link
Member

aik099 commented Feb 27, 2014

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.

@rdpanek
Copy link
Author

rdpanek commented Feb 27, 2014

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
Copy link
Author

rdpanek commented Feb 27, 2014

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

@aik099
Copy link
Member

aik099 commented Apr 14, 2014

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.

@suswari
Copy link

suswari commented Jun 7, 2018

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

@oleg-andreyev
Copy link
Contributor

@suswari because it should be pageLoad, see comment from #122 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants