Webdriver.get(url) open Firefox but not the URL

半腔热情 提交于 2020-01-05 07:14:42

问题


I am using this code in Python:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
driver.get("www.google.com")

Unlucky, this open Firefox but not the URL (not return any error). Do you know why?


回答1:


If you are using Selenium 3.x along with the recent Frirefox Quantum browsers, you have to download geckodriver.exe from this location place it in your system and mention the absolute location of the geckodriver binary through the argument executable_path as follows:

from selenium import webdriver

driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()


来源:https://stackoverflow.com/questions/48045412/webdriver-geturl-open-firefox-but-not-the-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!