Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium-无法禁用第三方Cookie阻止_Python_Selenium - Fatal编程技术网

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

Python Selenium-无法禁用第三方Cookie阻止,python,selenium,Python,Selenium,每当我登录网站时,页面被阻止加载所有内容,这是由于第三方cookie阻止 为了访问页面上的所有数据,我必须允许每次登录时使用cookie。我甚至允许在chrome设置中使用所有cookie 我使用了driver.get_cookie(),但仍然无法继续 请帮忙 代码: 您可以尝试使用下一种方法来创建一个简单的解决方案 driver.maximize_window() driver.get('website') WebDriverWait(driver,30).until(EC.title_

每当我登录网站时,页面被阻止加载所有内容,这是由于第三方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()