这是我的代码,我想使用
myProfile
配置文件执行 Firefox 并运行一个网站,但它加载了一个空配置文件:
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options as Firefox_Options
from time import sleep
path = r'C:\Program Files\Mozilla Firefox\firefox.exe'
user_data = r'C:\Users\Saeed\AppData\Local\Mozilla\Firefox\Profiles\someChars.myProfile'
gecko = r'D:\Downloads\geckodriver-v0.33.0-win64\geckodriver.exe'
firefox_options = Firefox_Options()
firefox_options.binary = path
service = Service(executable_path=gecko, options=firefox_options, firefox_profile=user_data)
driver = webdriver.Firefox(service=service)
driver.get('https://api.ipify.org')
sleep(10)
我确实在
myProfile
中设置了代理,所以如果加载正确,它应该会显示我代理的 IP。但相反,它使用的是空配置文件并显示我的 ADSL 的 IP。
我用谷歌搜索并做了其他网站和 StackOverFlow 上的答案所说的,但没有一个对我有用。