【发布时间】:2021-05-06 00:37:55
【问题描述】:
我正在尝试使用 Selenium Python 登录我的 dvd.netflix 帐户,但我一直收到不正确的登录信息(尽管输入了正确的用户名和密码),因为身份验证请求由于 cors 错误而失败。
这是我正在使用的代码:
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('https://dvd.netflix.com/SignIn')
username_input = '//*[@id="email"]'
password_input = '//*[@id="password"]'
login_submit = '//*[@id="signin"]/button'
driver.find_element_by_xpath(username_input).send_keys("justtest0219@gmail.com")
driver.find_element_by_xpath(password_input).send_keys("12345")
driver.find_element_by_xpath(login_submit).click()
我得到的错误:
Access to XMLHttpRequest at 'https://portal.dvd.netflix.com/auth/authenticate' from origin 'https://dvd.netflix.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
我也尝试禁用 CORS 检查,但仍然无法登录,如果我尝试使用 WebDriver for Chrome 手动登录,它确实会登录
【问题讨论】:
-
用您看到的错误更新问题。
-
完成。错误在控制台日志中。
标签: python selenium selenium-webdriver cors webdriverwait