我正在尝试使用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