需要自动登录Python支持

2024-06-25 23:15:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我进入我的第一个星期学习python,并期待着自动登录到一个网站。我可以进入该网站,并获得用户名和密码输入,但问题是提交/登录按钮。我已经尝试使用相同的用户名和密码使用下面的,但它没有找到这个id,我正在使用检查工具在chrome上找到的id,因为我做了用户名和密码。你知道吗

driver.find_element_by_id('GSubmitButtton-8f6df913-9588-4480-9944-538b785b8ece').click()

错误消息

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="GSubmitButtton-8f6df913-9588-4480-9944-538b785b8ece"]"}

driver.find_element_by_id('GSubmitButtton-8f6df913-9588-4480-9944-538b785b8ece').click()

登录URL=https://www.gamma-portal.com/login.jspa


Tags: 工具id密码by网站driver错误element
1条回答
网友
1楼 · 发布于 2024-06-25 23:15:10

是否可以使用XPath来定位登录按钮?你知道吗

您可以通过以下方式找到:

  1. 右击 在“登录”按钮上
  2. 单击下拉列表中的inspect
  3. 是吗 单击按钮元素
  4. 选择复制
  5. 复制XPath

然后将结果输入此行(替换####)

driver.find_element_by_xpath("###").click()

Some documentation for this method here!

相关问题 更多 >