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

前端 未结 18 1832
醉梦人生
醉梦人生 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:47

    I was facing exactly the same issue, after browsing for sometime,I came to know that it is basically version compatibility issue between FireFox and selenium. I have got the latest FireFox but my Selenium imported was older which is causing the issue. Issue got resolved after upgrading selenium

    pip install -U selenium
    

    OS: windows Python 2.7

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

    Try the following code

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    
    WebDriver DRIVER = new FirefoxDriver();
    DRIVER.get("http://www.google.com");
    
    0 讨论(0)
  • 2020-11-29 07:50

    You need to first declare url as a sting as below:

    from selenium import webdriver
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
    import time
    
    
    # Create a new instance of the Firefox driver
    
    String URL = "http://www.google.com";
    
    driver = webdriver.Firefox()
    
    
    # go to the google home page
    driver.get(URL);
    
    0 讨论(0)
  • 2020-11-29 07:51

    I had the similar problem. All I had to do was delete the existing geckodriver.exe and download the latest release of the same. You can find the latest release here https://github.com/mozilla/geckodriver/releases.

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

    Check your browser version and do the following.

    1. Download the Firefox/Chrome webdriver from Google

    2. Put the webdriver in Chrome's directory.

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

    Please have a look at this HowTo: http://www.qaautomation.net/?p=373 Have a close look at section "Instantiating WebDriver"

    I think you are missing the following code line:

    wait = new WebDriverWait(driver, 30);
    

    Put it between

    driver = webdriver.Firefox();
    

    and

    driver.getUrl("http://www.google.com");
    

    Haven't tested it, because I'm not using Selenium at the moment. I'm familiar with Selenium 1.x.

    0 讨论(0)
提交回复
热议问题