WebDriverException: Message: 'Can not connect to the ChromeDriver'. Error in utils.is_connectable(self.port):

后端 未结 5 1576
情深已故
情深已故 2020-12-06 13:16

I am trying to use the chromedriver 2.10 to run my tests on Chrome Browser Version 35.0.1916.114 On CentOS machine

/home/varunm/EC_WTF_0.4.10/EC_WTF

5条回答
  •  独厮守ぢ
    2020-12-06 13:41


    For Linux

    1. Check you have installed latest version of chrome brwoser-> "chromium-browser -version"
    2. If not, install latest version of chrome "sudo apt-get install chromium-browser"
    3. get appropriate version of chrome driver from following link http://chromedriver.storage.googleapis.com/index.html
    4. Unzip the chromedriver.zip
    5. Move the file to /usr/bin/ directory sudo mv chromedriver /usr/bin/
    6. Goto /usr/bin/ directory and you would need to run something like "chmod a+x chromedriver" to mark it executable.
    7. finally you can execute the code.

    import os
    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()
    

提交回复
热议问题