Selenium WebDriver.get(url) does not open the URL

前端 未结 18 1831
醉梦人生
醉梦人生 2020-11-29 07:36
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui impo         


        
相关标签:
18条回答
  • 2020-11-29 07:36

    I have resolved this issue.

    If your jar files are older than the latest version and the browser has updated to latest version, then download:

    • the latest jar files from the selenium website http://www.seleniumhq.org/download/, and
    • the latest geckodriver.exe.
    0 讨论(0)
  • 2020-11-29 07:38

    I got the same error when issuing a URL without the protocol (like localhost:4200) instead of a correct one also specifying the protocol (e.g. http://localhost:4200).

    Google Chrome works fine without the protocol (it takes http as the default), but Firefox crashes with this error.

    0 讨论(0)
  • 2020-11-29 07:40

    If your are using it in windows machine, check whether the selenium webdriver you have installed is of the latest one. I just now explored that my webdriver is of old one and it just opens the firefox but it couldn't process the get function.

    Updation of the webdriver resolves this problem

    0 讨论(0)
  • 2020-11-29 07:41

    @Neeraj

    I've resolved this problem, but i'm not sure if you are the same reason.

    In general, my problem was caused by some permission issues.

    I tried to move my whole project into ~/:

    mv xxx/ ~/
    

    and then i change give it the 777 permission:

    chmod -R 777 xxx/
    

    I'm not familiar with linux permission so i just do this to make sure i have permission to execute the program.

    Even you don't have permission, the selenium program will not prompt you.

    So, good luck.

    0 讨论(0)
  • 2020-11-29 07:41

    Since you mentioned you use a proxy, try setting up the firefox driver with a proxy by following the answer given here proxy selenium python firefox

    0 讨论(0)
  • 2020-11-29 07:43

    I had the same problem but with Chrome.

    Solved it using the following steps

    1. Install Firefox/Chrome webdriver from Google
    2. Put the webdriver in Chrome's directory.

    Here's the code and it worked fine

    from selenium import webdriver
    
    class InstaBot(object):
        def __init__(self):
            self.driver=webdriver.Chrome("C:\Program 
            Files(x86)\Google\Chrome\Application\chromedriver.exe")# make sure 
                                                          #it is chrome driver 
            self.driver.get("https://www.wikipedia.com")
            
            
    InstaBot()
    
    0 讨论(0)
提交回复
热议问题