gpt4 book ai didi

python - 键盘无法访问元素
转载 作者:行者123 更新时间:2023-12-01 08:34:08 25 4
gpt4 key购买 nike

我正在尝试登录需要凭据的网站。我在密码页面上收到以下错误:

ElementNotInteractableException: Element <div id="password" class="rFrNMe KSczvd uyaebd BlbNGe zKHdkd sdJrJc Tyc9J"> is not reachable by keyboard

这是罪犯。

enter image description here

有什么解决办法吗?我在 Google 上搜索了 SO 的解决方案,并看到了一些关于 Java 的评论。我正在使用Python,但我还没有找到任何有用的东西。这是我的全部代码。

from bs4 import BeautifulSoup as bs
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
import time
import requests
import urllib.request
import pandas as pd


wd = webdriver.Firefox(executable_path="C:/Utility/geckodriver.exe", firefox_profile=profile)
url = 'https://intra-net-website.com/'
wd.get(url)

# set username
time.sleep(2)
username = wd.find_element_by_id("identifierId")
username.send_keys("first.last@gmail.com")
wd.find_element_by_id("identifierNext").click()

# error occurs here
# set password
time.sleep(2)
password = wd.find_element_by_id("password")
password.send_keys("my_password")
wd.find_element_by_id("passwordNext").click()

如果我手动输入密码,一切都会正常,但这违背了自动化这项工作的目的。也许有一种方法可以欺骗系统。不确定。

最佳答案

从图像来看,您可能希望将send_keys发送到带有name“password”的输入。

password = wd.find_element_by_name("password")

关于python - 键盘无法访问元素 <div id ="password",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53804029/

25 4 0

Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com