0

Вот мой код, что тут не так?

from selenium import webdriver
from fake_useragent import UserAgent
user=UserAgent()
profile=webdriver.FirefoxProfile()
profile.set_preference('general.useragent.override',user.random)
driver=webdriver.FirefoxProfile(profile)
driver.get('https://rabota.ykt.ru/') 

Вот ошибка

 driver=webdriver.FirefoxProfile(profile)
File "E:\Python\rabota\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 80, in __init__
ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
File "C:\Users\Вадим\AppData\Local\Programs\Python\Python37-32\lib\shutil.py", line 318, in copytree
names = os.listdir(src)
TypeError: listdir: path should be string, bytes, os.PathLike or None, not FirefoxProfile

Парсинг изучаю недавно, поэтому не знаю, я понимаю, что там связано с firefoxProfile, но что именно не понимаю.

1 ответ 1

1
driver=webdriver.FirefoxProfile(profile)

ты инициализируешь профиль передавая в качестве первого аргумента профиль. а ждешь инстанс драйвера.

driver=webdriver.Firefox(profile)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.