<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 隱式等待與顯式等待 ### 什么是顯示等待和隱式等待? 顯示等待就是**有條件**的等待 隱式等待就是**無條件**的等待 > 隱式等待 當使用了隱式等待執行測試的時候,如果 WebDriver沒有在 DOM中找到元素,將繼續等待,超出設定時間后則拋出找不到元素的異常, 換句話說,當查找元素或元素并沒有立即出現的時候,隱式等待將等待一段時間再查找 DOM,默認的時間是0、 ~~~ from selenium import webdriver browser = webdriver.Chrome() browser.implicitly_wait(10)#等待十秒加載不出來就會拋出異常,10秒內加載出來正常返回 browser.get('[https://www.zhihu.com/explore](https://www.zhihu.com/explore)') input = browser.find_element_by_class_name('zu-top-add-question') print(input) ~~~ > 顯式等待 指定一個等待條件,和一個最長等待時間,程序會判斷在等待時間內條件是否滿足,如果滿足則返回,如果不滿足會繼續等待,超過時間就會拋出異常 ~~~ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC browser = webdriver.Chrome() browser.get('https://www.taobao.com/') wait = WebDriverWait(browser, 10) input = wait.until(EC.presence_of_element_located((By.ID, 'q'))) button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.btn-search'))) print(input, button) ~~~ ~~~ title_is 標題是某內容 title_contains 標題包含某內容 presence_of_element_located 元素加載出,傳入定位元組,如(By.ID, 'p') visibility_of_element_located 元素可見,傳入定位元組 visibility_of 可見,傳入元素對象 presence_of_all_elements_located 所有元素加載出 text_to_be_present_in_element 某個元素文本包含某文字 text_to_be_present_in_element_value 某個元素值包含某文字 frame_to_be_available_and_switch_to_it frame加載并切換 invisibility_of_element_located 元素不可見 element_to_be_clickable 元素可點擊 staleness_of 判斷一個元素是否仍在DOM,可判斷頁面是否已經刷新 element_to_be_selected 元素可選擇,傳元素對象 element_located_to_be_selected 元素可選擇,傳入定位元組 element_selection_state_to_be 傳入元素對象以及狀態,相等返回True,否則返回False element_located_selection_state_to_be 傳入定位元組以及狀態,相等返回True,否則返回False alert_is_present 是否出現Alert ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看