• <legend id='wH4QW'><style id='wH4QW'><dir id='wH4QW'><q id='wH4QW'></q></dir></style></legend>
        <bdo id='wH4QW'></bdo><ul id='wH4QW'></ul>

        <tfoot id='wH4QW'></tfoot>

        <i id='wH4QW'><tr id='wH4QW'><dt id='wH4QW'><q id='wH4QW'><span id='wH4QW'><b id='wH4QW'><form id='wH4QW'><ins id='wH4QW'></ins><ul id='wH4QW'></ul><sub id='wH4QW'></sub></form><legend id='wH4QW'></legend><bdo id='wH4QW'><pre id='wH4QW'><center id='wH4QW'></center></pre></bdo></b><th id='wH4QW'></th></span></q></dt></tr></i><div id='wH4QW'><tfoot id='wH4QW'></tfoot><dl id='wH4QW'><fieldset id='wH4QW'></fieldset></dl></div>
      1. <small id='wH4QW'></small><noframes id='wH4QW'>

      2. __init__() 接受 2 个位置参数,但使用 WebDriverWait 和 expected_condition

        时间:2023-07-04

              <tbody id='zR3rz'></tbody>

            • <bdo id='zR3rz'></bdo><ul id='zR3rz'></ul>
              <i id='zR3rz'><tr id='zR3rz'><dt id='zR3rz'><q id='zR3rz'><span id='zR3rz'><b id='zR3rz'><form id='zR3rz'><ins id='zR3rz'></ins><ul id='zR3rz'></ul><sub id='zR3rz'></sub></form><legend id='zR3rz'></legend><bdo id='zR3rz'><pre id='zR3rz'><center id='zR3rz'></center></pre></bdo></b><th id='zR3rz'></th></span></q></dt></tr></i><div id='zR3rz'><tfoot id='zR3rz'></tfoot><dl id='zR3rz'><fieldset id='zR3rz'></fieldset></dl></div>
              <legend id='zR3rz'><style id='zR3rz'><dir id='zR3rz'><q id='zR3rz'></q></dir></style></legend>

                  <tfoot id='zR3rz'></tfoot>
                • <small id='zR3rz'></small><noframes id='zR3rz'>

                • 本文介绍了__init__() 接受 2 个位置参数,但使用 WebDriverWait 和 expected_conditions 给出了 3 个作为 element_to_be_clickable 和 Selenium Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我看到了类似的问题,但就我而言,我的代码中甚至没有init"函数.如何解决这个问题呢?问题在于 (EC.element_to_bo_clickable)

                  I saw similar questions but in my case there is not even "init" function in my code. How to solve this problem? The problem is with line (EC.element_to_bo_clickable)

                  from selenium.webdriver.common.by import By
                  from selenium.webdriver.support.ui import WebDriverWait
                  from selenium.webdriver.support import expected_conditions as EC
                  
                  driver = webdriver.Chrome(executable_path="C:Chromedriverchromedriver.exe")
                  driver.implicitly_wait(1)
                  driver.get("https://cct-103.firebaseapp.com/")
                  
                  element = WebDriverWait(driver, 1).until
                  (EC.element_to_be_clickable(By.CLASS_NAME, "MuiButton-label"))
                  
                  element.click()
                  

                  推荐答案

                  根据定义,element_to_be_clickable() 应该在 tuple 中调用,因为它不是 函数 而是一个 class,其中初始化器只期望 implicit self 之外的 1 参数:

                  According to the definition, element_to_be_clickable() should be called within a tuple as it is not a function but a class, where the initializer expects just 1 argument beyond the implicit self:

                  class element_to_be_clickable(object):
                      """ An Expectation for checking an element is visible and enabled such that you can click it."""
                      def __init__(self, locator):
                          self.locator = locator
                  
                      def __call__(self, driver):
                          element = visibility_of_element_located(self.locator)(driver)
                          if element and element.is_enabled():
                              return element
                          else:
                              return False
                  

                  所以而不是:

                  element = WebDriverWait(driver, 1).until(EC.element_to_be_clickable(By.CLASS_NAME, "MuiButton-label"))
                  

                  您需要(添加额外的括号):

                  You need to (add an extra parentheses):

                  element = WebDriverWait(driver, 1).until((EC.element_to_be_clickable(By.CLASS_NAME, "MuiButton-label")))
                  

                  这篇关于__init__() 接受 2 个位置参数,但使用 WebDriverWait 和 expected_conditions 给出了 3 个作为 element_to_be_clickable 和 Selenium Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:selenium 网格监听节点端口而不是集线器端口 下一篇:Webdriver 截图

                  相关文章

                    <tfoot id='xxd5V'></tfoot>
                      <bdo id='xxd5V'></bdo><ul id='xxd5V'></ul>

                      <legend id='xxd5V'><style id='xxd5V'><dir id='xxd5V'><q id='xxd5V'></q></dir></style></legend>
                    1. <small id='xxd5V'></small><noframes id='xxd5V'>

                      <i id='xxd5V'><tr id='xxd5V'><dt id='xxd5V'><q id='xxd5V'><span id='xxd5V'><b id='xxd5V'><form id='xxd5V'><ins id='xxd5V'></ins><ul id='xxd5V'></ul><sub id='xxd5V'></sub></form><legend id='xxd5V'></legend><bdo id='xxd5V'><pre id='xxd5V'><center id='xxd5V'></center></pre></bdo></b><th id='xxd5V'></th></span></q></dt></tr></i><div id='xxd5V'><tfoot id='xxd5V'></tfoot><dl id='xxd5V'><fieldset id='xxd5V'></fieldset></dl></div>