WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

前端 未结 29 3467
旧巷少年郎
旧巷少年郎 2020-11-21 07:11

I am trying to launch chrome with an URL, the browser launches and it does nothing after that.

I am seeing the below error after 1 minute:

Unable to         


        
29条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-21 07:38

    I ran into same issue, i am using UBUNTU, PYTHON and OPERA browser. in my case the problem was originated because i had an outdated version of operadriver.

    Solution: 1. Make sure you install latest opera browser version ( do not use opera beta or opera developer), for that go to the official opera site and download from there the latest opera_stable version.

    1. Install latest opera driver (if you already have an opera driver install, you have to remove it first use sudo rm ...)

    wget https://github.com/operasoftware/operachromiumdriver/releases/download/v.80.0.3987.100/operadriver_linux64.zip

       unzip operadriver_linux64.zip
       sudo mv operadriver /usr/bin/operadriver
       sudo chown root:root /usr/bin/operadriver
       sudo chmod +x /usr/bin/operadriver
    

    in my case latest was 80.0.3987 as you can see

    1. Additionally i also installed chromedriver (but since i did it before testing, i do not know of this is needed) in order to install chromedriver, follow the steps on previous step :v

    2. Enjoy and thank me!

    Sample selenium code

    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    driver = webdriver.Opera()
    driver.get("http://www.python.org")
    assert "Python" in driver.title
    elem = driver.find_element_by_name("q")
    elem.clear()
    elem.send_keys("pycon")
    elem.send_keys(Keys.RETURN)
    assert "No results found." not in driver.page_source
    driver.quit()
    

提交回复
热议问题