在打电话给" get"时,selenium firefox webdriver正在崩溃。功能。只有在我使用firefox_profile时才会出现错误,当firefox_profile = None时一切正常。我使用的是Windows 10,Firefox 53.0.2 64位,Gecko驱动程序v0.16.1 win64,selenium 3.4.1和python 3.5.1
以下是我的代码
context.canvas.height = window.innerHeight;
context.canvas.width = window.innerWidth;
以下是我收到的错误
from selenium import webdriver
import os
downloadsDir = os.path.join(os.getenv('HOMEPATH'),"Downloads")
geckoDriverPath = ""
for file in os.listdir(downloadsDir):
if file.startswith("geckodriver") and not file.endswith(".log"):
geckoDriverPath = os.path.join(downloadsDir, file)
break
profilesDir = os.path.join(os.getenv('APPDATA') , "Mozilla", "Firefox", "Profiles")
ffProfileDir = ""
for profile in os.listdir(profilesDir):
if profile.endswith(".default"):
ffProfileDir = os.path.join(profilesDir, profile)
break
firefoxDeskopProfile = webdriver.FirefoxProfile(profile_directory=ffProfileDir)
#If I change the line below to "firefoxDesktopDriver = webdriver.Firefox(executable_path=geckoDriverPath)" then the code succeeds
firefoxDesktopDriver = webdriver.Firefox(firefox_profile=firefoxDeskopProfile, executable_path=geckoDriverPath)
firefoxDesktopDriver.get("https://www.google.com")
答案 0 :(得分:-1)
已多次测试过,真的我在使用需要通过浏览器进行身份验证的网络时会收到此错误但是当我更改为没有身份验证的网络时它工作正常