RF/Selenium (sometimes) get stuck while running test

560 views
Skip to first unread message

Zeevik Neuman

unread,
May 5, 2016, 1:00:44 PM5/5/16
to robotframework-users
Hi
As described in the subject, from time to time RobotFramework/Selenium test would get stuck (see logs below)
Happens randomly, not related to a specific test, SUT or environment.
test just getting stuck as if it waits for something.
It happens on random(?)places in the code, so I cannot relate it to a specific piece of code.

Any ideas what goes wrong? And how to fix that ?

Any help/directions would be highly appreciated
Thanks,
Zeevik 

The last messages in the output.xml (before I "kill" the test by clicking CTRL-C)
<msg timestamp="20160504 22:16:37.698" level="DEBUG">Finished Request</msg>
<msg timestamp="20160504 22:16:37.899" level="DEBUG">POST http://127.0.0.1:37042/hub/session/1b01879a-0f7c-443f-8a1c-158bc06637de/elements {"using": "xpath", "sessionId": "1b01879a-0f7c-443f-8a1c-158bc06637de", "value": "//body/main//div//textarea[contains(@class,'new-message-input')]"}</msg>
<msg timestamp="20160504 22:16:37.919" level="DEBUG">Finished Request</msg>
<msg timestamp="20160504 22:16:38.119" level="DEBUG">POST http://127.0.0.1:37042/hub/session/1b01879a-0f7c-443f-8a1c-158bc06637de/elements {"using": "xpath", "sessionId": "1b01879a-0f7c-443f-8a1c-158bc06637de", "value": "//body/main//div//textarea[contains(@class,'new-message-input')]"}</msg>



Once killing the test, the last error seen is 
 
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
   
raise err
error
: [Errno 111] Connection refused</msg>



And the full stack trace is 
<msg timestamp="20160505 01:24:15.595" level="INFO">Traceback (most recent call last):
  File "/home/zeevik/testing-automation-code/resources/MarketingProjectSingle.py", line 123, in marketing_project_brief
    provider.login(provider_name, provider_email, "Test1234")
  File "/home/zeevik/testing-automation-code/resources/service_providerUI.py", line 29, in login
    self.driver.wait_until_page_contains("Looks like you have no projects",2)
  File "&lt;decorator-gen-156&gt;", line 2, in wait_until_page_contains
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/keywordgroup.py", line 15, in _run_on_failure_decorator
    return method(*args, **kwargs)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_waiting.py", line 46, in wait_until_page_contains
    self._wait_until(timeout, error, self._is_text_present, text)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_waiting.py", line 231, in _wait_until
    self._wait_until_no_error(timeout, wait_func)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_waiting.py", line 237, in _wait_until_no_error
    timeout_error = wait_func(*args)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_waiting.py", line 230, in wait_func
    return None if function(*args) else error
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_element.py", line 722, in _is_text_present
    return self._is_element_present(locator)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_element.py", line 772, in _is_element_present
    return (self._element_find(locator, True, False, tag=tag) is not None)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_element.py", line 678, in _element_find
    elements = self._element_finder.find(browser, locator, tag)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/locators/elementfinder.py", line 37, in find
    return strategy(browser, criteria, tag, constraints)
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/locators/elementfinder.py", line 79, in _find_by_xpath
    browser.find_elements_by_xpath(criteria),
  File "/home/zeevik/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 270, in find_elements_by_xpath
    return self.find_elements(by=By.XPATH, value=xpath)
  File "/home/zeevik/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 739, in find_elements
    {'using': by, 'value': value})['value']
  File "/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/webdrivermonkeypatches.py", line 11, in execute
    result = self._base_execute(driver_command, params)
  File "/home/zeevik/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 199, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/zeevik/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute
    return self._request(command_info[0], url, body=data)
  File "/home/zeevik/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 425, in _request
    self._conn.request(method, parsed_url.path, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1052, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1092, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1048, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 892, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 854, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 831, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
error: [Errno 111] Connection refused
</msg>




Hélio Guilherme

unread,
May 5, 2016, 1:49:59 PM5/5/16
to robotframework-users
Here are my thoughts about your question/problem.
I see that Selenium2Library is installed locally in your user home ("/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_element.py") and then there are calls to system

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Hélio Guilherme

unread,
May 5, 2016, 1:55:33 PM5/5/16
to robotframework-users
Sorry about that clicked Send too soon.


Here are my thoughts about your question/problem.
I see that Selenium2Library is installed locally in your user home ("/home/zeevik/.local/lib/python2.7/site-packages/Selenium2Library/keywords/_element.py") and then there are calls to system python install ("/usr/lib/python2.7/socket.py"). Maybe this problem would not happen if using only system installation (less timeouts?).

You don't mention the versions you are using.
Did you install using `pip`?

 

dm08

unread,
May 5, 2016, 1:58:41 PM5/5/16
to heliox...@gmail.com, robotframework-users
Hi,

I have also have such kind of problem with open browser and chrome on ubuntu only. It is seldom stuck on it. That is some kind of webdriver issue so in my case I just use timeout for this keyword to keep my test running. 

Thanks,
Dmitriy

Tatu Aalto

unread,
May 5, 2016, 2:03:45 PM5/5/16
to zee...@zeevik.net, robotframework-users

Ugh

Because the output.xml file is buffered and it may not contain the correct keyword. Have you looked what debug[1] file contains?

-Tatu
[1] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#debug-file

Zeevik Neuman

unread,
May 5, 2016, 2:49:48 PM5/5/16
to robotframework-users
Sorry for missing that info.
I've installed it using pip.
RF version Version: 2.9.2
Selenium2library version 1.74

Happens with Firefox or Chrome browser on Ubuntu.

Zeevik Neuman

unread,
May 5, 2016, 2:51:54 PM5/5/16
to robotframework-users, zee...@zeevik.net
Thanks for the tip.
As there is no specific piece of code which makes it stuck, I would not know where to add the timeout.
All wait actions do have timeouts (default or manually set).
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages