【发布时间】:2021-10-27 21:00:45
【问题描述】:
import time
import pyautogui
import sys
from selenium import webdriver
tabTimer = 0
fileRun = __file__
fileRun = fileRun.replace("app.py", "geckodriver.exe")
print(fileRun)
stall = input("enter filepath: ")
driver = webdriver.Firefox(fileRun)
driver.get("htpps://google.com")
每当我尝试打开 geckodriver 时,无论是使用下面使用的方法还是手动将文件路径输入为 r"",它无论出于何种原因都不起作用并生成以下错误。感谢您的帮助或建议,谢谢!
c:\Users\ellio\Desktop\main\app.py:22: DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object
driver = webdriver.Firefox(fileRun)
Traceback (most recent call last):
File "c:\Users\ellio\Desktop\main\app.py", line 22, in <module>
driver = webdriver.Firefox(fileRun)
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 160, in __init__
firefox_profile = FirefoxProfile(firefox_profile)
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 74, in __init__
shutil.copytree(self.profile_dir, newprof,
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 555, in copytree
with os.scandir(src) as itr:
NotADirectoryError: [WinError 267] The directory name is invalid: 'c:\\Users\\ellio\\Desktop\\main\\geckodriver.exe'
【问题讨论】:
标签: python python-3.x selenium-webdriver