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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 在 Selenium IDE 中驗證 Element Present,waitFor 和 Wait > 原文: [https://www.guru99.com/enhancing-selenium-ide-script.html](https://www.guru99.com/enhancing-selenium-ide-script.html) 在本教程中,我們將介紹可使您的自動化腳本更加智能和完整的命令。 * [驗證元素](#1)的存在 * [驗證特定文本的存在](#2) * [驗證元素](#3)的特定位置 * [和等待命令](#4) * [waitFor 命令](#5) ## 驗證元素的存在 我們可以使用以下兩個命令來驗證元素的存在: * **verifyElementPresent** -如果在頁面中找到了指定的元素,則返回 TRUE; 否則為 FALSE * **verifyElementNotPresent** -如果在頁面的任何地方都找不到指定的元素,則返回 TRUE; 如果存在,則為 FALSE。 下面的測試腳本驗證了 Mercury Tours 主頁中是否存在“用戶名”文本框,而沒有“名字”文本框。 “名字”文本框實際上是一個元素,該元素存在于 Mercury Tours 的“注冊”頁面中,而不是在主頁中。 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/17/26/1726deda0c77db06008420e724cc7072_527x175.png "How to enhance a script using Selenium IDE") ## 驗證特定文本的存在 * **verifyTextPresent** -如果在頁面中的某處找到了指定的文本字符串,則返回 TRUE;否則,返回 TRUE。 否則為 FALSE * **verifyTextNotPresent** -如果在頁面的任何地方都找不到指定的文本字符串,則返回 TRUE;否則,返回 TRUE。 如果找到,則為 FALSE 請記住,這些命令區分大小寫。 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/4a/2c/4a2cbe8af4b4916063b296a6b17f9581_390x252.png "How to enhance a script using Selenium IDE") 在上述情況下,“亞特蘭大到拉斯維加斯”與“亞特蘭大到拉斯維加斯”的處理方式有所不同,因為“亞特蘭大”的字母“ A”在第一個字母中大寫,在另一個字母中小寫。 當對每個命令使用 verifyTextPresent 命令時,一個命令通過,而另一個失敗。 ## 驗證元素的特定位置 Selenium IDE 通過測量(以像素為單位)元素與瀏覽器窗口左邊緣或上邊緣的距離來指示元素的位置。 * **verifyElementPositionLeft** -驗證指定的像素數是否與元素到頁面左邊緣的距離匹配。 如果指定的值與左邊緣的距離不匹配,則將返回 FALSE。 * **verifyElementPositionTop** -驗證指定的像素數是否匹配元素到頁面頂部邊緣的距離。 如果指定的值與上邊緣的距離不匹配,則將返回 FALSE。 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/49/88/49889b50645a50fdc51324411a0dd8fa_512x321.png "How to enhance a script using Selenium IDE") ## 等待命令 ## 和等待命令 這些命令在進入下一個命令之前將等待新頁面加載。 例子是 * clickAndWait * typeAndWait * 選擇并等待 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/dc/8d/dc8ddf905098141b1d21f949e24764c2_470x496.png "How to enhance a script using Selenium IDE") ## waitFor 命令 這些命令將等待指定條件變為真,然后繼續執行下一個命令(與裝入新頁面無關)。 這些命令更適合在基于 AJAX 的動態網站上使用,這些網站可以更改值和元素而無需重新加載整個頁面。 示例包括: * waitForTitle * waitForTextPresent * 等待警報 考慮下面的 Facebook 場景。 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/3c/54/3c54d60c2c3dabd5c932fce178ef74b8_682x363.png "How to enhance a script using Selenium IDE") 我們可以結合使用“ click”和“ waitForTextPresent”來驗證文本“ Providing your Birthday”的存在。 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/04/93/0493943560747c5abba006eca9baa044_414x143.png "How to enhance a script using Selenium IDE") 我們無法使用 clickAndWait,因為單擊“為什么需要提供我的生日?”時沒有頁面加載。 鏈接。 如果這樣做,測試將失敗 ![Waits, Verify Element Present/Visible in Selenium IDE](https://img.kancloud.cn/ef/06/ef06a43276a36bf6c90a338c46b3a045_423x353.png "How to enhance a script using Selenium IDE") ## 摘要 * 驗證頁面元素時最常用的三個命令是: * verifyElementPresent / verifyElementNotPresent * verifyTextPresent / verifyTextNotPresent * verifyElementPositionLeft / verifyElementPositionTop * 等待命令分為兩種: * andWait 命令-在預期要加載頁面時使用 * waitFor 命令-在預期不加載新頁面時使用
                  <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>

                              哎呀哎呀视频在线观看