<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(或逻辑求值)

        WebDriverWait for multiple conditions (OR logical evaluation)(多个条件的WebDriverWait(或逻辑求值))
        <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(或逻辑求值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  GUI Freezes while downloading PyQt5 and Pytube(GUI在下载PyQt5和Pytube时冻结)
                  How to solve memory issues while multiprocessing using Pool.map()?(如何解决使用Pool.map()进行多处理时的内存问题?)
                  Python - How to use FastAPI and uvicorn.run without blocking the thread?(Python-如何使用FastAPI和uvicorn.run而不阻塞线程?)
                  How to increment a shared counter from multiple processes?(如何从多个进程递增共享计数器?)
                  Using pika, how to connect to rabbitmq running in docker, started with docker-compose with external network?(使用pika,如何连接运行在docker中的rabbitmq,从docker开始-与外部网络连接?)
                  How to use .rolling() on each row of a Pandas dataframe?(如何对 pandas 数据帧的每一行使用.roll()?)

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

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