<bdo id='sfUsJ'></bdo><ul id='sfUsJ'></ul>

        <small id='sfUsJ'></small><noframes id='sfUsJ'>

        <tfoot id='sfUsJ'></tfoot><legend id='sfUsJ'><style id='sfUsJ'><dir id='sfUsJ'><q id='sfUsJ'></q></dir></style></legend>

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

        多个条件的WebDriverWait(或逻辑求值)

        时间:2024-08-10
        <legend id='sGbF0'><style id='sGbF0'><dir id='sGbF0'><q id='sGbF0'></q></dir></style></legend>
          <bdo id='sGbF0'></bdo><ul id='sGbF0'></ul>
            1. <tfoot id='sGbF0'></tfoot>

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

                  <small id='sGbF0'></small><noframes id='sGbF0'>

                  本文介绍了多个条件的WebDriverWait(或逻辑求值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用python,WebDriverWait方法用于等待1个元素出现在网页上。 如何在没有多次尝试/例外的情况下使用此方法? 使用此方法的多个案例是否有OR选项? https://selenium-python.readthedocs.io/waits.html

                  推荐答案

                  无需使用多个try/except{}通过OR选项为两个元素诱导WebDriverWait,您可以使用以下任一解决方案:

                  • 使用CSS_SELECTOR

                    element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, ".element_A_class, .element_B_class"))
                    
                  • 使用XPATH至lambda:

                    element = WebDriverWait(driver,20).until(lambda driver: driver.find_element(By.XPATH,"element_A_xpath") or driver.find_element(By.XPATH,"element_B_xpath"))
                    

                  引用

                  您可以在以下位置找到几个相关的讨论:

                  • selenium two xpath tests in one
                  • Python / Selenium: Logic Operators in WebDriverWait Expected Conditions

                  这篇关于多个条件的WebDriverWait(或逻辑求值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何用Pipenv解决Python包依赖问题? 下一篇:Linux Python Azure函数app-pyodbc模块未找到,尽管在Requirements.txt和其他模块

                  相关文章

                  <small id='hM1Ky'></small><noframes id='hM1Ky'>

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