Python Selenium-无法禁用第三方Cookie阻止

时间:2020-10-31 11:48:54

标签: python selenium

每当我登录该网站时,该页面就无法加载所有内容,这是由于第三方cookie阻止所致。

为了访问页面上的所有数据,每次登录时都必须允许cookie。我什至允许Chrome设置中的所有cookie。

我使用过driver.get_cookie(),但仍然无法继续。

请帮助

代码:

driver.maximize_window() 

driver.get('website')

WebDriverWait(driver,30).until(EC.title_contains("Sign in to your account"))

username_input = '//*[@id="116"]'

next_button = '//*[@id="idon9"]'

driver.find_element_by_xpath(username_input).send_keys("abc@gmail.com")

driver.find_element_by_xpath(next_button).click()

driver.implicitly_wait(10)

keep_me_signed_in = '//*[@id="kinput"]'

password_input = '//*[@id="paoinput"]'

sign_in_button = '//*[@id="subon"]'

driver.find_element_by_xpath(password_input).send_keys("password")

driver.find_element_by_xpath(sign_in_button).click()

dont_show_this_again = '//*[@id="checkfield"]'

yes_button = '//*[@id="on9"]'

driver.find_element_by_xpath(dont_show_this_again).click()

driver.find_element_by_xpath(yes_button).click()

cook = driver.get_cookie()
    
driver.delete_all_cookies()

0 个答案:

没有答案