the property must index for chromedriver chrome google-chrome selenium centos google-chrome-devtools selenium-chromedriver

google chrome - property - Chrome no pudo iniciarse en CentOS utilizando chromedriver2.9



the path to the driver executable must be set by the webdriver.chrome.driver system property (1)

Env: chromedriver 2.9, google-chrome-stable 34, python 2.6, CentOS6.4 final x86_64

Instalo google-chrome-stable (no cromo) siga install-chrome.sh . Puede extraer paquetes de fedoraproject e instalar esos paquetes en /opt/google/chrome/lib . Instalo chromedriver2.9 follow link . Puedo ejecutar google-chrome y chromedriver manualmente sin error. Instalo selenio por pip install selenium (selenio 2.41). Selenium está instalado en /usr/lib/python2.6/site-packages/ . Parece que Google-chrome instalado de esta manera no se abre como root.

Cuando ejecuto el código en la consola de python con un usuario no root como sigue:

>>> from selenium import webdriver >>> driver = webdriver.Chrome()

Devuelve el siguiente mensaje de error en lugar de abrir cromo.

Traceback (most recent call last): File "<stdin>", line 3, in <module> File "/usr/lib/python2.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 65, in __init__ keep_alive=True) File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 72, in __init__ self.start_session(desired_capabilities, browser_profile) File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 115, in start_session ''desiredCapabilities'': desired_capabilities, File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 166, in execute self.error_handler.check_response(response) File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: u''unknown error: Chrome failed to start: crashed/n (Driver info: chromedriver=2.9.248304,platform=Linux 2.6.32-358.el6.x86_64 x86_64)''

Recibo el enlace de seguimiento de seguimiento Error desconocido: Chrome no se pudo iniciar: salió de manera anormal . No hay solución en ese enlace. ¿Que debería hacer? Gracias.

[0.987][INFO]: COMMAND InitSession { "desiredCapabilities": { "browserName": "chrome", "chromeOptions": { "args": [ ], "extensions": [ ] }, "javascriptEnabled": true, "platform": "ANY", "version": "" }, "sessionId": null } [0.987][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_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 } } [0.988][INFO]: Populating Local State file: { "background_mode": { "enabled": false }, "ssl": { "rev_checking": { "enabled": false } } } [0.988][INFO]: Launching chrome: /opt/google/chrome/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --full-memory-crash-report --ignore-certificate-errors --load-extension=/tmp/.com.google.Chrome.NnyvZ9/internal --logging-level=1 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12775 --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.AtCYvH data:, [0.989][DEBUG]: DevTools request: http://127.0.0.1:12775/json/version [0.991][WARNING]: PAC support disabled because there is no system implementation [1.034][DEBUG]: DevTools request failed [1.084][DEBUG]: DevTools request: http://127.0.0.1:12775/json/version [1.085][DEBUG]: DevTools request failed [1.135][DEBUG]: DevTools request: http://127.0.0.1:12775/json/version [1.136][DEBUG]: DevTools request failed ..... ..... [61.022][DEBUG]: DevTools request: http://127.0.0.1:12775/json/version [61.024][DEBUG]: DevTools request failed [61.024][INFO]: RESPONSE InitSession unknown error: Chrome failed to start: crashed [61.025][DEBUG]: Log type ''driver'' lost 0 entries on destruction [61.025][DEBUG]: Log type ''browser'' lost 0 entries on destruction

Estoy confundido acerca de esas cosas DevTools , tampoco.


¿Estás usando sin cabeza? Si es así, deberá especificar la pantalla sin cabeza a través de pyvirtualdisplay .

Tuve el mismo error (registro) cuando estaba usando selenio sin cabeza sin decirle selenio para usar la visualización. Después de instalar pyvirtualdisplay , el siguiente código funciona para mí:

from selenium import webdriver from pyvirtualdisplay import Display display = Display(visible=0, size=(800, 600)) display.start() driver = webdriver.Chrome() driver.get("http://www.google.com") print driver.page_source.encode(''utf-8'') driver.quit() display.stop()