Firefox没有启动si

2024-03-29 09:51:13 发布

您现在位置:Python中文网/ 问答频道 /正文

geckodriver确实启动了Firefox,但Firefox没有获得url。请查看并指出我的函数有什么问题。我对selenium和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)

Tags: 函数fromimporturldriverseleniumlogincommon
2条回答

这仅仅意味着要么你的lib是旧的,要么Gecko二进制是旧的。新的壁虎图书馆现在可用。你知道吗

下载地址:

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

从以下URL下载selenium python libs的新版本:

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

马丁指出的另一件事

在传递URL之前添加httphttps这样的协议

所以使用URL作为:

url = "https://www.google.com"

可能有多种原因-

  1. 尝试在url中包含HTTP协议,即-http://www.google.com

  2. 你可能在代理服务器后面。看看这个问题->;Selenium WebDriver: Firefox starts, but does not open the URL&;Selenium WebDriver.get(url) does not open the URL

  3. 驱动程序和浏览器的版本不匹配。

相关问题 更多 >