无法在linux 7机器上启动chromedriver

时间:2017-12-01 09:37:29

标签: linux selenium selenium-chromedriver

我没有在我的linux机器上安装显示器,我的要求是抓取网页并使用selenium chrome webdriver获取一些信息。我在我的linux 7机器上安装了chrome和chromedriver,版本 2.33.506092 。现在,当我尝试运行chromedriver二进制文件时,它会挂起一段时间,显示在下面

Starting ChromeDriver 2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4) on port 9515 Only local connections are allowed.

然后输出一些错误。以下是输出:

Starting ChromeDriver 2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4) on port 9515

只允许本地连接。

[338.651][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browser": "chrome"
   }
}
[338.656][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[338.656][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[338.660][INFO]: Launching chrome: /opt/google/chrome --disable-background-networking --disable-browser-side-navigation --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension=/tmp/.org.chromium.Chromium.NEhqW7/internal --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12116 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.org.chromium.Chromium.6knWEC data:,
[338.661][DEBUG]: DevTools request: http://localhost:12116/json/version
LaunchProcess: failed to execvp:
/opt/google/chrome
[338.876][DEBUG]: DevTools request failed
[338.926][DEBUG]: DevTools request: http://localhost:12116/json/version
[338.927][DEBUG]: DevTools request failed
[338.977][DEBUG]: DevTools request: http://localhost:12116/json/version
[338.977][DEBUG]: DevTools request failed
[339.027][DEBUG]: DevTools request: http://localhost:12116/json/version
[339.028][DEBUG]: DevTools request failed
[339.078][DEBUG]: DevTools request: http://localhost:12116/json/version
[339.078][DEBUG]: DevTools request failed
[339.129][DEBUG]: DevTools request: http://localhost:12116/json/version
[339.129][DEBUG]: DevTools request failed
[339.179][DEBUG]: DevTools request: http://localhost:12116/json/version

1 个答案:

答案 0 :(得分:0)

我遇到了同样的错误,原因是Chrome和chromedriver的版本不兼容。我得到了这个组合。

ChromeDriver 2.36.540471 Google Chrome 66.0.3359.139

这对OP来说有点晚,但可能对其他人有所帮助。