Skip to content

Error with capture screenshot #56

Closed

Description

My tests fail during teardown with following errors, it seems screenshot capture fails.

13:27:59.164 TRACE Arguments: [ ]
13:27:59.174 DEBUG GET http://127.0.0.1:1363/hub/session/70000fba-176c-48cb-8f60-4adbfe323390/screenshot {"sessionId": "70000fba-176c-48cb-8f60-4adbfe323390"}
13:28:00.165 FAIL URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
13:28:00.165 DEBUG Traceback (most recent call last): File "", line 2, in capture_page_screenshot File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator return method(_args, *_kwargs) File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\keywords_screenshot.py", line 27, in capture_page_screenshot self._current_browser().save_screenshot(path) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 81, in save_screenshot png = RemoteWebDriver.execute(self, Command.SCREENSHOT)['value'] File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\webdrivermonkeypatches.py", line 11, in execute result = self._base_execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 151, in execute response = self.command_executor.execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 283, in execute return self._request(url, method=command_info[0], data=data) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 324, in _request response = opener.open(request) File "C:\Python27\lib\urllib2.py", line 391, in open response = self._open(req, data) File "C:\Python27\lib\urllib2.py", line 409, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 369, in _call_chain result = func(_args) File "C:\Python27\lib\urllib2.py", line 1173, in http_open return self.do_open(httplib.HTTPConnection, req) File "C:\Python27\lib\urllib2.py", line 1148, in do_open raise URLError(err)
13:28:00.175 TRACE Return: None
13:27:58.223 TRACE Arguments: [ ]
13:27:58.223 DEBUG Closing browser with session id 70000fba-176c-48cb-8f60-4adbfe323390
13:27:58.223 DEBUG DELETE http://127.0.0.1:1363/hub/session/70000fba-176c-48cb-8f60-4adbfe323390 {"sessionId": "70000fba-176c-48cb-8f60-4adbfe323390"}
13:28:00.175 WARN Keyword 'Capture Page Screenshot' could not be run on failure: URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
13:28:00.185 FAIL URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
13:28:00.185 DEBUG Traceback (most recent call last): File "", line 2, in close_browser File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator return method(_args, *_kwargs) File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\keywords_browsermanagement.py", line 50, in close_browser self._cache.close() File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\utils\browsercache.py", line 23, in close browser.quit() File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 61, in quit RemoteWebDriver.quit(self) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 443, in quit self.execute(Command.QUIT) File "C:\Python27\lib\site-packages\robotframework_selenium2library-1.0.0-py2.7.egg\Selenium2Library\webdrivermonkeypatches.py", line 11, in execute result = self._base_execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 151, in execute response = self.command_executor.execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 283, in execute return self._request(url, method=command_info[0], data=data) File "C:\Python27\lib\site-packages\selenium-2.21.3-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 324, in _request response = opener.open(request) File "C:\Python27\lib\urllib2.py", line 391, in open response = self._open(req, data) File "C:\Python27\lib\urllib2.py", line 409, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 369, in _call_chain result = func(_args) File "C:\Python27\lib\urllib2.py", line 1173, in http_open return self.do_open(httplib.HTTPConnection, req) File "C:\Python27\lib\urllib2.py", line 1148, in do_open raise URLError(err)
13:28:00.195 TRACE Return: None

Activity

  1. j1z0 commented on May 22, 2012

    @j1z0
    Contributor

    This important part of the error is :
    URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>

    This is usually because webdriver has already been shut down, or potentially you have some sort of firewall blocking access. The firewall doesn't really make sense if this error only occurs in teardown. So I would guess it's a timing issue. Is it possible that the browser or webdriver server has already been shut down? Can you send a sample script that reproduces the issue perhaps?

  2. j1z0 commented on May 23, 2012

    @j1z0
    Contributor

    Cool. I like an easy fix. :)

    Cheers,
    Jeremy

    On May 22, 2012, at 18:37, vrpatilreply@reply.github.com wrote:

    I found the cause of the error, there was 'close all browsers' keyword before teardown

    here is sample test, which will throw similar error,

    *** Settings ***
    Library Selenium2Library

    *** Test Cases ***
    Test
    Open Browser http://192.168.1.1
    Set Selenium Speed 2s
    Close All Browsers
    [Teardown]


    Reply to this email directly or view it on GitHub:
    #56 (comment)

  3. Gurud commented on Oct 29, 2012

    @Gurud

    *** Settings ***
    Library Selenium2Library

    **** Test case ****
    GoogleTest
    [Documentation] Verification from Google Search page
    [Tags] BIE
    Selenium2Library.Open Browser https://www.google.co.in/ ie
    Maximize Browser Window
    Selenium2Library.Title Should Be Google
    Selenium2Library.Input Text q Dealertrack canada
    Selenium2Library.Click Button btnG

    After run its Fail with below message -
    [ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: TypeErro
    r: must be string or buffer, not None
    Google Page :: Verification from Google Search page | FAIL |
    Title should have been 'Google' but was ''

    Please provide inputs to solve it soon.

    Cheers, Gaurav

  4. emanlove commented on Dec 11, 2012

    @emanlove
    Member

    @Gurud If you are still experiencing an issue please reopen another issue or, even better, post a question to the robotframework-users mailing list, http://groups.google.com/group/robotframework-users.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions