当前位置: 首页 > 知识库问答 >
问题:

如何使用Python Selenium在网站https://app.buenbit.com/dashboard中登录

连曜灿
2023-03-14
  import time
from datetime import date
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options

options = Options()

browser = webdriver.Chrome('C:/chromedriver.exe',chrome_options=options)
browser.get('https://app.buenbit.com/dashboard')

usuario = browser.find_element_by_xpath('//*[@id="root"]/div/div[3]/div[1]/form/div[1]/input')


browser.quit()

这就是错误所在

回溯(最近一次调用):文件“c:/proyectos/scrapy/mercadolibre hide.py”,第12行,在usuario=browser.find_element_by_xpath('//[@id=“root”]/div/div[3]/div[1]/form/div[1]/input')文件“c:\users\vrodrig5\appdata\roaming\python\python38\site-packages\selenium\webdriver\remote\webdriver.py”,第394行,在find_element_by_xpath中返回self.find_element(by=by.xpath,value=xpath)文件“g5\appdata\roaming\python\python38\site-packages\selenium\webdriver\remote\webdriver.py”,第976行,在find_element中返回self.execute(命令find_element,{File“C:\users\vrodrig5\appdata\roaming\python\python38\site-packages\selenium\webdriver\remote\webdriver.py”,第321行,在execute self.error_handler.check_response(响应)文件“C:\users\vrodrig5\appdata\roaming\python\python38\site-packages\selenium\webdriver.py”TION_CLASS(消息,屏幕,stacktrace)Selenium.Common.Exceptions.NoSuChelementException:消息:no这样的元素:找不到元素:{“method”:“XPath”,“selector”:“//[@id=”root“]/div/div[3]/div[1]/form/div[1]/input”}(会话信息:chrome=81.0.4044.138)

共有1个答案

呼延震博
2023-03-14

要使用一组有效的凭据在网站https://app.buenbit.com/中登录,您需要引导WebDriverWait等待所需的element_to_be_clickable(),并且您可以使用以下任一定位器策略:

>

  • 使用css_selector:

    driver.get("https://app.buenbit.com/")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='email']"))).send_keys("Victor_Rodriguez")
    

    使用XPath:

    driver.get("https://app.buenbit.com/")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='email']"))).send_keys("Victor_Rodriguez")
    

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

  •  类似资料:
    • 问题内容: 我想访问网站https://myoffice.bt.com的某些页面,该页面需要使用Java进行用户身份验证。我们必须先登录才能访问页面。我写了以下代码。 但是它给出了以下错误。 如果我取消注释get.setFollowingRedirects行,则会出现另一个错误。 有人能帮我一下吗?我们可以使用HttpClient进行基于表单的身份验证吗? 谢谢。 问题答案: 首先-请不要命名您的

    • 问题内容: 我看到了另一个问题:如何使用Python登录网页并检索cookie以供以后使用? 但是,对该答案进行直接修改对我不起作用,因此我想知道如何实现我的目标。 为了提供上下文,我尝试登录,然后从以下页面中提取播放列表的名称: 我认为对于知道自己在做什么的人来说,这应该很简单。一些基本的代码可以登录到该网站并访问受密码保护的页面,这非常棒,如果您能用一两句话来解释代码中的每一行在做什么,那会更

    • 问题内容: 我正在编写一个Java程序来登录学校用来发布成绩的网站。 这是登录表单的网址:https : //ma- andover.myfollett.com/aspen/logon.do 这是登录表单的HTML: 我正在尝试使用以下代码登录: 该程序将填充用户名框,然后单击“登录”按钮,但不会填充密码框。我可以进行哪些更改以使该程序正常运行?我怀疑密码框的“ type =’password’”

    • 我想用java编写登录网站的代码。 下面是代码: 我曾在Facebook和Gmail上尝试过这段代码,但问题是它不起作用。 它一直告诉我cookies没有启用。(我使用了chrome浏览器,它们已启用)。 有没有其他方法可以实现这一点?

    • 问题内容: 在此网站上,您可以输入您的学生卡号,然后显示该卡上还剩多少钱。我想使用JSOUP获得信息。这是我当前的代码,但是不起作用, 我没有太多经验,所以我不知道在哪里寻找问题。一些想法: 我应该使用还是? 在使用chrome devoloper工具时,发布数据是我使用功能发送的所有数据。但是,如果发送时出现错误,为什么? 我应该发送解密或加密的数据吗?(两者均在chrome devoloper

    • 问题内容: 我正在尝试使用Python登录到此页面。 我尝试使用另一篇文章中描述的步骤,并获得了以下代码: 但这给了我以下输出: 我究竟做错了什么? 问题答案: 我建议使用精彩的模块。 下面的代码将使您登录到该站点,并在会话期间将cookie保留下来。