• <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

        __init__() takes 2 positional arguments but 3 were given using WebDriverWait and expected_conditions as element_to_be_clickable with Selenium Python(__init__() 接受 2 个位置参数,但使用 WebDriverWait 和 expected_conditions 给出了 3 个作为 e

              <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)

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

                          <tbody id='xxd5V'></tbody>
                          <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>