0

geckodriver does launch Firefox but firefox doesn't get url. Please see and point what's wrong with my function. would be great help as im very new to selenium and python

import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

def Login(SiteUrl):
  driver = webdriver.Firefox()
  driver.get(SiteUrl)

if __name__ =="__main__":

 url = "www.google.com"

 Login(url)
user3121891
  • 1,807
  • 3
  • 15
  • 13

2 Answers2

1

There could be multiple reasons -

  1. Try including HTTP protocol in the url i.e. - http://www.google.com

  2. You might be behind a proxy server. See this SO question -> Selenium WebDriver: Firefox starts, but does not open the URL & Selenium WebDriver.get(url) does not open the URL

  3. Your versions of the driver and the browser does not match.

Ashish Mathew
  • 783
  • 5
  • 20
  • I think it was Firefox not compatible with latest version of selenium/gecko driver. I just shifted to newer version of 'Firefox phantom' and it started to work – user3121891 Nov 20 '17 at 11:36
0

That simply means either your libs are old or Gecko binary is old. New gecko-libs are available now.

Download it from :

https://github.com/mozilla/geckodriver/releases

Download new version of selenium python libs from below URL:

https://pypi.python.org/pypi/selenium

Another thing as Martin point out

Add the protocol like http or https before passing URL

So use URL as :

url = "https://www.google.com"
halfer
  • 19,824
  • 17
  • 99
  • 186
Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
  • 1
    I think it was Firefox not compatible with latest version of selenium/gecko driver. I just shifted to newer version of 'Firefox phantom' and it started to work – user3121891 Nov 20 '17 at 10:20