{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/geckodriver/issues/399","repository_url":"https://api.github.com/repos/mozilla/geckodriver","labels_url":"https://api.github.com/repos/mozilla/geckodriver/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/geckodriver/issues/399/comments","events_url":"https://api.github.com/repos/mozilla/geckodriver/issues/399/events","html_url":"https://github.com/mozilla/geckodriver/issues/399","id":195948102,"number":399,"title":"Selenium 3.0.1+ Firefox 50.0 would sometimes have connection refused","user":{"login":"HackToday","id":10363809,"avatar_url":"https://avatars.githubusercontent.com/u/10363809?v=3","gravatar_id":"","url":"https://api.github.com/users/HackToday","html_url":"https://github.com/HackToday","followers_url":"https://api.github.com/users/HackToday/followers","following_url":"https://api.github.com/users/HackToday/following{/other_user}","gists_url":"https://api.github.com/users/HackToday/gists{/gist_id}","starred_url":"https://api.github.com/users/HackToday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackToday/subscriptions","organizations_url":"https://api.github.com/users/HackToday/orgs","repos_url":"https://api.github.com/users/HackToday/repos","events_url":"https://api.github.com/users/HackToday/events{/privacy}","received_events_url":"https://api.github.com/users/HackToday/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-12-15T23:56:05Z","updated_at":"2016-12-18T19:00:16Z","closed_at":"2016-12-16T01:29:09Z","body":"If you are having an issue with GeckoDriver starting up, please make sure that your client bindings support using it.\r\n\r\n## Meta -\r\nOS:  CentOS 7.2\r\ne.g.: Windows 10? OSX?\r\n\r\nBrowser Version:   Firefox 50.0\r\ne.g.: 50.0.2623.87 (64-bit)\r\n\r\n## Expected Behavior -\r\nTest would run OK\r\n\r\n## Actual Behavior -\r\nSometimes test would fail with connection refused, it is clearly not test issue, it is possible about selenium or Firefox issue\r\n\r\n## Steps to reproduce -\r\n_Note:_ Please be sure to include an SSCCE (Short, Self Contained, Correct [compilable] example) http://sscce.org/\r\nIf you can't provide a link to the page, consider creating a reproducible page on https://jsfiddle.net/\r\n\r\nCan not give a easy steps to reproduce, it can sometime happen. (maybe 3 in 10 times)\r\n\r\n```\r\nrequest = <SubRequest 'driver' for <Function 'test_app_rs_edit_port'>>\r\ndriver_class = <class 'selenium.webdriver.firefox.webdriver.WebDriver'>\r\ndriver_kwargs = {'firefox_profile': <selenium.webdriver.firefox.firefox_profile.FirefoxProfile object at 0x2603c10>}\r\n\r\n    @pytest.yield_fixture\r\n    def driver(request, driver_class, driver_kwargs):\r\n        \"\"\"Returns a WebDriver instance based on options and capabilities\"\"\"\r\n>       driver = driver_class(**driver_kwargs)\r\n\r\n/usr/lib/python2.7/site-packages/pytest_selenium/pytest_selenium.py:107: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py:145: in __init__\r\n    keep_alive=True)\r\n/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:92: in __init__\r\n    self.start_session(desired_capabilities, browser_profile)\r\n/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:179: in start_session\r\n    response = self.execute(Command.NEW_SESSION, capabilities)\r\n/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:236: in execute\r\n    self.error_handler.check_response(response)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\nself = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x273fad0>\r\nresponse = {'status': 500, 'value': '{\"error\":\"unknown error\",\"message\":\"connection refused\"}'}\r\n\r\n    def check_response(self, response):\r\n        \"\"\"\r\n            Checks that a JSON response from the WebDriver does not have an error.\r\n    \r\n            :Args:\r\n             - response - The JSON response from the WebDriver server as a dictionary\r\n               object.\r\n    \r\n            :Raises: If the response contains an error message.\r\n            \"\"\"\r\n        status = response.get('status', None)\r\n        if status is None or status == ErrorCode.SUCCESS:\r\n            return\r\n    \r\n        value = None\r\n        message = response.get(\"message\", \"\")\r\n        screen = response.get(\"screen\", \"\")\r\n        stacktrace = None\r\n        if isinstance(status, int):\r\n            value_json = response.get('value', None)\r\n            if value_json and isinstance(value_json, basestring):\r\n                import json\r\n                try:\r\n                    value = json.loads(value_json)\r\n                    status = value.get('error', None)\r\n                    if status is None:\r\n                        status = value[\"status\"]\r\n                        message = value[\"value\"]\r\n                        if not isinstance(message, basestring):\r\n                            value = message\r\n                            try:\r\n                                message = message['message']\r\n                            except TypeError:\r\n                                message = None\r\n                    else:\r\n                        message = value.get('message', None)\r\n                except ValueError:\r\n                    pass\r\n    \r\n        exception_class = ErrorInResponseException\r\n        if status in ErrorCode.NO_SUCH_ELEMENT:\r\n            exception_class = NoSuchElementException\r\n        elif status in ErrorCode.NO_SUCH_FRAME:\r\n            exception_class = NoSuchFrameException\r\n        elif status in ErrorCode.NO_SUCH_WINDOW:\r\n            exception_class = NoSuchWindowException\r\n        elif status in ErrorCode.STALE_ELEMENT_REFERENCE:\r\n            exception_class = StaleElementReferenceException\r\n        elif status in ErrorCode.ELEMENT_NOT_VISIBLE:\r\n            exception_class = ElementNotVisibleException\r\n        elif status in ErrorCode.INVALID_ELEMENT_STATE:\r\n            exception_class = InvalidElementStateException\r\n        elif status in ErrorCode.INVALID_SELECTOR \\\r\n                or status in ErrorCode.INVALID_XPATH_SELECTOR \\\r\n                or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:\r\n            exception_class = InvalidSelectorException\r\n        elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:\r\n            exception_class = ElementNotSelectableException\r\n        elif status in ErrorCode.INVALID_COOKIE_DOMAIN:\r\n            exception_class = WebDriverException\r\n        elif status in ErrorCode.UNABLE_TO_SET_COOKIE:\r\n            exception_class = WebDriverException\r\n        elif status in ErrorCode.TIMEOUT:\r\n            exception_class = TimeoutException\r\n        elif status in ErrorCode.SCRIPT_TIMEOUT:\r\n            exception_class = TimeoutException\r\n        elif status in ErrorCode.UNKNOWN_ERROR:\r\n            exception_class = WebDriverException\r\n        elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:\r\n            exception_class = UnexpectedAlertPresentException\r\n        elif status in ErrorCode.NO_ALERT_OPEN:\r\n            exception_class = NoAlertPresentException\r\n        elif status in ErrorCode.IME_NOT_AVAILABLE:\r\n            exception_class = ImeNotAvailableException\r\n        elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:\r\n            exception_class = ImeActivationFailedException\r\n        elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:\r\n            exception_class = MoveTargetOutOfBoundsException\r\n        else:\r\n            exception_class = WebDriverException\r\n        if value == '' or value is None:\r\n            value = response['value']\r\n        if isinstance(value, basestring):\r\n            if exception_class == ErrorInResponseException:\r\n                raise exception_class(response, value)\r\n            raise exception_class(value)\r\n        if message == \"\" and 'message' in value:\r\n            message = value['message']\r\n    \r\n        screen = None\r\n        if 'screen' in value:\r\n            screen = value['screen']\r\n    \r\n        stacktrace = None\r\n        if 'stackTrace' in value and value['stackTrace']:\r\n            stacktrace = []\r\n            try:\r\n                for frame in value['stackTrace']:\r\n                    line = self._value_or_default(frame, 'lineNumber', '')\r\n                    file = self._value_or_default(frame, 'fileName', '<anonymous>')\r\n                    if line:\r\n                        file = \"%s:%s\" % (file, line)\r\n                    meth = self._value_or_default(frame, 'methodName', '<anonymous>')\r\n                    if 'className' in frame:\r\n                        meth = \"%s.%s\" % (frame['className'], meth)\r\n                    msg = \"    at %s (%s)\"\r\n                    msg = msg % (meth, file)\r\n                    stacktrace.append(msg)\r\n            except TypeError:\r\n                pass\r\n        if exception_class == ErrorInResponseException:\r\n            raise exception_class(response, message)\r\n        elif exception_class == UnexpectedAlertPresentException and 'alert' in value:\r\n            raise exception_class(message, screen, stacktrace, value['alert'].get('text'))\r\n>       raise exception_class(message, screen, stacktrace)\r\nE       WebDriverException: Message: connection refused\r\n\r\n/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py:192: WebDriverException\r\n\r\n```\r\n\r\nAs issue here https://github.com/SeleniumHQ/selenium/issues/3201  selenium guys said `The connection refused would be happening when trying to communicate with GeckoDriver`\r\n\r\n - [x] A [trace level log](https://github.com/mozilla/geckodriver#firefox-capabilities) from geckodriver showing the issue\r\n - [ ] A minimal HTML file (or files) that can be used to reproduce the issue\r\n - [ ] A Selenium code snippet that can be run as is to reproduce the issues\r\n\r\n** If any of the above are missing we will have to unforunately close your issue. We will gladly reopen the issue once all the information requested has been added **\r\n"},"comment":{"url":"https://api.github.com/repos/mozilla/geckodriver/issues/comments/267839152","html_url":"https://github.com/mozilla/geckodriver/issues/399#issuecomment-267839152","issue_url":"https://api.github.com/repos/mozilla/geckodriver/issues/399","id":267839152,"user":{"login":"cgoldberg","id":1113081,"avatar_url":"https://avatars.githubusercontent.com/u/1113081?v=3","gravatar_id":"","url":"https://api.github.com/users/cgoldberg","html_url":"https://github.com/cgoldberg","followers_url":"https://api.github.com/users/cgoldberg/followers","following_url":"https://api.github.com/users/cgoldberg/following{/other_user}","gists_url":"https://api.github.com/users/cgoldberg/gists{/gist_id}","starred_url":"https://api.github.com/users/cgoldberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgoldberg/subscriptions","organizations_url":"https://api.github.com/users/cgoldberg/orgs","repos_url":"https://api.github.com/users/cgoldberg/repos","events_url":"https://api.github.com/users/cgoldberg/events{/privacy}","received_events_url":"https://api.github.com/users/cgoldberg/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T19:00:16Z","updated_at":"2016-12-18T19:00:16Z","body":"@HackToday why don't you just check which process is bound to port 2828?  That will most likely give you a clue as to what is going on.\r\n\r\nbtw, an arbitrary process list (your `ps` log) wouldn't show anything useful."}}
{"actor":{"display_login":"cgoldberg"}}