selenium.common.exceptions.WebDriverException: Message: connection refused

前端 未结 7 621
野趣味
野趣味 2020-11-30 09:14

Here is my code:

from selenium import webdriver

browser = webdriver.Firefox()

browser.get(\'http://www.python.org\')

browser.close()

It

7条回答
  •  野性不改
    2020-11-30 09:29

    This could be for various reasons.

    • Most probably because the "latest" version of your geckodriver is not able to communicate with your "slightly older" firefox.

    • The easiest way to fix this would be to try out different older versions of geckodriver. Run the following command to find the current version of your geckodriver

      geckodriver --version
      
    • If it shows the version as 19 or above, execute following steps to use geckodriver version 17(Works 90% of times)

      1. Your existing geckodriver most typically may be placed in /usr/local/bin when u installed it earlier. First delete this by running sudo rm -r /usr/local/bin/geckodriver

      2. Download version 17 of geckodriver from this link. Move the downloaded file(geckodriver-v0.17.0-arm7hf.tar.gz) from your Downloads folder into your home directory

      3. Unpack the file

        tar -xzvf geckodriver-v0.17.0-arm7hf.tar.gz
        

        This will create a folder called "geckodriver" in your home directory

      4. Move/Copy this extracted "geckodriver" into /usr/local/bin/

        sudo cp geckodriver /usr/local/bin/
        
      5. Run

        sudo reboot
        

    Rerun your program now...
    It should work!

提交回复
热议问题