AttributeError: 'bool' object has no attribute 'Click'

Stacey丶梦菡
Stacey丶梦菡
订阅者
299
文章
0
粉丝
测试交流2371字数 132阅读0分26秒阅读模式
摘要i'm trying to automate a login process on moodle but when i try to find and send keys in t...

我试图在moodle上自动完成登录过程,但当我试图在用户名中查找并发送密钥时,feild是一个错误
这是我的代码:

from selenium.webdriver.common.by import By
import webbrowser
from selenium import webdriver
driver = webdriver.Chrome(r'D:Installchromedriver_win32chromedriver.exe')
driver.get("https://lms.jspmrscoe.edu.in/?redirect=0")
username = driver.find_element(By.NAME, 'username').is_displayed()
username.Click()
username.send_keys("name*emphasized text*")

在找到元素之前,代码运行良好,但当我试图通过单击它时。click()显示如下错误:

AttributeError: 'bool' object has no attribute 'Click'

 
  • 版权提示:非本站文章仅供存储任何法律责任由作者承担▷违法举报◁▷新闻不符◁▷我要投稿◁
    免责声明:部分内容来自用户上传发布或新闻客户端自媒体如有侵权请反馈站长处理
  • 原创转载:阅读转载说明>>> https://www.playezu.com/zixun/jiaoliu/attributeerror-039bool039-object-has-no-attribute-039click039.html
评论  2  访客  2
    • Mbula Mboma Jean gilbert
      Mbula Mboma Jean gilbert 9

      您正在调用单击布尔值,下面是解决方案:
      from selenium.webdriver.common.by import By
      import webbrowser
      from selenium import webdriver
      driver = webdriver.Chrome(r’D:Installchromedriver_win32chromedriver.exe’)
      driver.get("https://lms.jspmrscoe.edu.in/?redirect=0")
      username = driver.find_element(By.NAME, ‘username’)

      #in case you want to click when username is diplayed
      # do this
      if username.is_displayed():
      username.Click()
      username.send_keys("name*emphasized text*")

      • The Thonnu
        The Thonnu 9

        在这一行中:
        用户名 = driver.find_element(By.NAME, ‘用户名’).是否显示()

        这个 是否显示() 函数被调用。
        此返回 真的 或 假 -布尔值。
        您不能调用 .单击() 功能开启 用户名 因为布尔函数没有这个函数

      匿名

      发表评论

      匿名网友
      确定

      拖动滑块以完成验证