Geckodriver无法打开

时间:2018-12-08 05:54:11

标签: python selenium geckodriver

我正在尝试使用geckodriver启动FireFox并转到instagram.com。当我运行我的代码时,它会启动FireFox,但只坐在一个空白选项卡上,并且不会加载instagram。我有设置geckodriver的路径,并且已经安装了硒。

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


class InstagramBot:


    def __init__(self, username, password):
        self.username = username
        self.password = password
        self.driver = webdriver.Firefox()

    def closeBrowser(self):
        self.driver.close()

    def login(self):
        driver = self.driver
        driver.get("https://www.instagram.com/")
        time.sleep(2)

        # "//a[@href'accounts/login/?source=auth_switcher']"
        # "//input[@name='username']"
        # "//input[@name='password']"

monchaosIG = InstagramBot("username", "passoword")
monchaosIG.login

1 个答案:

答案 0 :(得分:1)

这是因为不兼容的应用程序版本,您需要安装持久的GeckodriverFirefox