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

Intermittent setup errors in wdspec tests (TimeoutException: timeout (500): Failed to get window handle) #23895

Open
jdm opened this issue Jul 31, 2019 · 1 comment

Comments

@jdm
Copy link
Member

@jdm jdm commented Jul 31, 2019

cc @georgeroman

  ▶ TIMEOUT [expected OK] /webdriver/tests/add_cookie/add.py

  ▶ TIMEOUT [expected OK] /webdriver/tests/element_send_keys/events.py

  ▶ Unexpected subtest result in /webdriver/tests/set_window_rect/set.py:
  └ PASS [expected FAIL] test_negative_x_y

  ▶ Unexpected subtest result in /webdriver/tests/get_element_text/get.py:
  │ ERROR [expected PASS] test_read_element_text
  │   → setup error
  │ 
  │ capabilities = {}
  │ configuration = {'capabilities': {}, 'host': '127.0.0.1', 'port': 54704}
  │ request = <SubRequest 'session' for <Function 'test_read_element_text'>>
  │ 
  │     @pytest.fixture(scope="function")
  │     def session(capabilities, configuration, request):
  │         """Create and start a session for a test that does not itself test session creation.
  │     
  │         By default the session will stay open after each test, but we always try to start a
  │         new one and assume that if that fails there is already a valid session. This makes it
  │         possible to recover from some errors that might leave the session in a bad state, but
  │         does not demand that we start a new session per test."""
  │         global _current_session
  │     
  │         # Update configuration capabilities with custom ones from the
  │         # capabilities fixture, which can be set by tests
  │         caps = copy.deepcopy(configuration["capabilities"])
  │         caps.update(capabilities)
  │         caps = {"alwaysMatch": caps}
  │     
  │         # If there is a session with different capabilities active, end it now
  │         if _current_session is not None and (
  │                 caps != _current_session.requested_capabilities):
  │             _current_session.end()
  │             _current_session = None
  │     
  │         if _current_session is None:
  │             _current_session = webdriver.Session(
  │                 configuration["host"],
  │                 configuration["port"],
  │                 capabilities=caps)
  │         try:
  │ >           _current_session.start()
  │ 
  │ capabilities = {}
  │ caps       = {'alwaysMatch': {}}
  │ configuration = {'capabilities': {}, 'host': '127.0.0.1', 'port': 54704}
  │ request    = <SubRequest 'session' for <Function 'test_read_element_text'>>
  │ 
  │ tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py:150: 
  │ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  │ tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py:429: in start
  │     value = self.send_command("POST", "session", body=body)
  │ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  │ 
  │ self = <Session (disconnected)>, method = 'POST', url = 'session'
  │ body = {'capabilities': {'alwaysMatch': {}}}
  │ 
  │     def send_command(self, method, url, body=None):
  │         """
  │             Send a command to the remote end and validate its success.
  │     
  │             :param method: HTTP method to use in request.
  │             :param uri: "Command part" of the HTTP request URL,
  │                 e.g. `window/rect`.
  │             :param body: Optional body of the HTTP request.
  │     
  │             :return: `None` if the HTTP response body was empty, otherwise
  │                 the `value` field returned after parsing the response
  │                 body as JSON.
  │     
  │             :raises error.WebDriverException: If the remote end returns
  │                 an error.
  │             :raises ValueError: If the response body does not contain a
  │                 `value` key.
  │             """
  │         response = self.transport.send(
  │             method, url, body,
  │             encoder=protocol.Encoder, decoder=protocol.Decoder,
  │             session=self)
  │     
  │         if response.status != 200:
  │             err = error.from_response(response)
  │     
  │             if isinstance(err, error.InvalidSessionIdException):
  │                 # The driver could have already been deleted the session.
  │                 self.session_id = None
  │     
  │ >           raise err
  │ E           TimeoutException: timeout (500): Failed to get window handle
  │ 
  │ body       = {'capabilities': {'alwaysMatch': {}}}
  │ err        = <TimeoutException http_status=500>
  │ method     = 'POST'
  │ response   = <Response status=500 error=<TimeoutException http_status=500>>
  │ self       = <Session (disconnected)>
  │ url        = 'session'
  │ 
  └ tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py:480: TimeoutException

  ▶ Unexpected subtest result in /webdriver/tests/get_element_text/get.py:
  │ ERROR [expected FAIL] test_getting_text_of_a_non_existant_element_is_an_error
  │   → setup error
  │ 
  │ capabilities = {}
  │ configuration = {'capabilities': {}, 'host': '127.0.0.1', 'port': 54704}
  │ request = <SubRequest 'session' for <Function 'test_getting_text_of_a_non_existant_element_is_an_error'>>
  │ 
  │     @pytest.fixture(scope="function")
  │     def session(capabilities, configuration, request):
  │         """Create and start a session for a test that does not itself test session creation.
  │     
  │         By default the session will stay open after each test, but we always try to start a
  │         new one and assume that if that fails there is already a valid session. This makes it
  │         possible to recover from some errors that might leave the session in a bad state, but
  │         does not demand that we start a new session per test."""
  │         global _current_session
  │     
  │         # Update configuration capabilities with custom ones from the
  │         # capabilities fixture, which can be set by tests
  │         caps = copy.deepcopy(configuration["capabilities"])
  │         caps.update(capabilities)
  │         caps = {"alwaysMatch": caps}
  │     
  │         # If there is a session with different capabilities active, end it now
  │         if _current_session is not None and (
  │                 caps != _current_session.requested_capabilities):
  │             _current_session.end()
  │             _current_session = None
  │     
  │         if _current_session is None:
  │             _current_session = webdriver.Session(
  │                 configuration["host"],
  │                 configuration["port"],
  │                 capabilities=caps)
  │         try:
  │ >           _current_session.start()
  │ 
  │ capabilities = {}
  │ caps       = {'alwaysMatch': {}}
  │ configuration = {'capabilities': {}, 'host': '127.0.0.1', 'port': 54704}
  │ request    = <SubRequest 'session' for <Function 'test_getting_text_of_a_non_existant_element_is_an_error'>>
  │ 
  │ tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py:150: 
  │ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  │ tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py:429: in start
  │     value = self.send_command("POST", "session", body=body)
  │ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  │ 
  │ self = <Session (disconnected)>, method = 'POST', url = 'session'
  │ body = {'capabilities': {'alwaysMatch': {}}}
  │ 
  │     def send_command(self, method, url, body=None):
  │         """
  │             Send a command to the remote end and validate its success.
  │     
  │             :param method: HTTP method to use in request.
  │             :param uri: "Command part" of the HTTP request URL,
  │                 e.g. `window/rect`.
  │             :param body: Optional body of the HTTP request.
  │     
  │             :return: `None` if the HTTP response body was empty, otherwise
  │                 the `value` field returned after parsing the response
  │                 body as JSON.
  │     
  │             :raises error.WebDriverException: If the remote end returns
  │                 an error.
  │             :raises ValueError: If the response body does not contain a
  │                 `value` key.
  │             """
  │         response = self.transport.send(
  │             method, url, body,
  │             encoder=protocol.Encoder, decoder=protocol.Decoder,
  │             session=self)
  │     
  │         if response.status != 200:
  │             err = error.from_response(response)
  │     
  │             if isinstance(err, error.InvalidSessionIdException):
  │                 # The driver could have already been deleted the session.
  │                 self.session_id = None
  │     
  │ >           raise err
  │ E           TimeoutException: timeout (500): Failed to get window handle
  │ 
  │ body       = {'capabilities': {'alwaysMatch': {}}}
  │ err        = <TimeoutException http_status=500>
  │ method     = 'POST'
  │ response   = <Response status=500 error=<TimeoutException http_status=500>>
  │ self       = <Session (disconnected)>
  │ url        = 'session'
  │ 
  └ tests/wpt/web-platform-tests/tools/webdriver/webdriver/client.py:480: TimeoutException
@georgeroman
Copy link
Contributor

@georgeroman georgeroman commented Jul 31, 2019

Never seen this one before. The only place this can get triggered from is here. Is it possible that this takes too long to get a response back?

@jdm jdm changed the title Intermittent setup errors in wdspec tests Intermittent setup errors in wdspec tests (TimeoutException: timeout (500): Failed to get window handle) Nov 19, 2019
@jdm jdm mentioned this issue Jan 14, 2020
2 of 2 tasks complete
@CYBAI CYBAI mentioned this issue May 26, 2020
0 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.