Вот мой код:
водитель
def dl_driver(dl_path,display):
pf = webdriver.FirefoxProfile()
pf.set_preference("browser.download.folderList", 2)
pf.set_preference("browser.download.manager.showWhenStarting", False)
pf.set_preference("browser.download.dir", dl_path)
pf.set_preference("browser.helperApps.neverAsk.saveToDisk",
"text/plain,text/x-csv,text/csv,application/vnd.ms-excel,application/csv,"
"application/x-csv,text/csv,text/comma-separated-values,text/x-comma-separated-values,"
"text/tab-separated-values,application/pdf,application/octet-stream")
# pf.set_preference("browser.link.open_newwindow", 1)
# pf.set_preference("browser.link.open_newwindow.restriction", 0)
options = Options()
options.set_preference("browser.link.open_newwindow.restriction", 0)
options.set_preference("browser.link.open_newwindow", 1)
if display.lower() == 'on':
driver = webdriver.Firefox(firefox_profile=pf,options=options)
else:
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options, firefox_profile=pf)
return driver
Тогда
driver = dl_driver('path/to/download/', display='on')
driver.get('driver.get(url='https://sellercentral.amazon.in/gp/homepage.html')
cookies = pickle.load(open("cookies.pkl", "rb"))
# the cookies were dumped with: pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
for cookie in cookies:
driver.add_cookie(cookie)
# Then I enter password and click signin
Работало нормально до пары дней go, но теперь это запрашивает OTP при каждом доступе.
Что-то не так с кодом выше?
TIA