我正试图在CC的登录页面中输入用户名(和密码)
但是,Selenium给了我一个错误:
"selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="username"]".
在尝试识别用户名id之前,我让页面加载5秒钟,但这没有帮助。我也尝试过通过xpath
和name
进行识别,但没有运气。有人知道会出什么问题吗
这是我试图登录的CC网页
以下是我目前的代码:
def login(url, usernameId, username, passwordId, password, submit_buttonId):
driver.get(url)
time.sleep(5)
driver.find_element_by_id(usernameId).send_keys(username) #username input box not being identified
driver.find_element_by_id(passwordId).send_keys(password)
driver.find_element_by_xpath(submit_buttonId).click()
login(
'https://cards.barclaycardus.com/',
'username', myBarclaysUsername,
'password', myBarclaysPassword,
'loginButton'
)
您有一个iframe开关
进口
你试过
wait.until
吗?看看这样做是否有效:有一个
iframe
,所以你必须切换到它相关问题 更多 >
编程相关推荐