<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、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 什么是 Selenium WebDriver? 與 RC 的區別 > 原文: [https://www.guru99.com/introduction-webdriver-comparison-selenium-rc.html](https://www.guru99.com/introduction-webdriver-comparison-selenium-rc.html) ### 什么是 WebDriver? WebDriver 是一個網絡自動化框架,可讓您針對不同的瀏覽器執行測試,而不僅僅是 Firefox,Chrome(與 Selenium IDE 不同)。 WebDriver 還使您可以**在創建測試腳本時使用編程語言**(在 Selenium IDE 中是不可能的)。 您現在可以使用**條件操作**,例如 if-then-else 或 switch-case。 您還可以像 do-while 一樣執行循環。 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/1e/8d/1e8d8d54bd1d44899dba9e685c863899_464x494.png "Introduction to WebDriver & Comparison with Selenium RC").jpg) WebDriver 支持以下編程語言 * [Java](/java-tutorial.html) * 。凈 * [PHP](/php-tutorials.html) * [Python](/python-tutorials.html) * [Perl](/perl-tutorials.html) * 紅寶石 **您不必全部了解。 您只需要一個人就可以了。** 但是,在本教程中,我們將使用 Java 和 Eclipse 作為我們的 IDE。 ## Selenium RC 和 Webdriver 之間的區別 在 2006 年 WebDriver 出現之前,還有另一個**自動化工具,稱為 Selenium Remote Control。** WebDriver 和 Selenium RC 都具有以下功能: * 它們都允許您**在設計測試腳本時使用編程語言**。 * 它們都允許您**在不同的瀏覽器上運行測試。** 那么它們有何不同? 讓我們討論答案。 ## 1.建筑 **WebDriver 的體系結構比 Selenium RC 的**更簡單。 * 它從操作系統級別控制瀏覽器 * 您只需要編程語言的 IDE(包含 Selenium 命令)和瀏覽器即可。 [![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/27/46/274675ddf847f1e1023b9bd26c178c38_407x353.png "Introduction to WebDriver & Comparison with Selenium RC") ](/images/simplified_webdriver_architecture.jpg) ##### Selenium RC 的體系結構要復雜得多。 * 在開始測試之前,您首先需要啟動**一個名為 Selenium Remote Control(RC)服務器**的單獨的應用程序。 * Selenium RC 服務器**充當 Selenium 命令和瀏覽器**之間的“中間人” * 當您開始測試時,Selenium RC Server 將名為 Selenium Core 的 **Javascript 程序“注入”瀏覽器。** * 注入后,Selenium Core 將開始從測試程序接收 RC 服務器中繼的指令。 * 收到指令后, **Selenium Core 將以 Javascript 命令的形式執行它們。** * 瀏覽器將遵循 Selenium Core 的說明,并將其響應中繼到 RC 服務器。 * RC 服務器將收到瀏覽器的響應,然后向您顯示結果。 * RC Server 將從測試腳本中獲取下一條指令,以重復整個周期。 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/04/b6/04b6eb9c7a11ad1aeeb7961736d90514_417x551.png "Introduction to WebDriver & Comparison with Selenium RC") ## 2.速度 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/c9/dc/c9dcd55d29390203a51fa96cc17c7a2c_134x109.png "Introduction to WebDriver & Comparison with Selenium RC") **WebDriver 比 Selenium RC 更快,因為它**直接與瀏覽器對話,使用瀏覽器自己的引擎對其進行控制。 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/0f/00/0f00a20a31bdcb60c8b312ac00192dad_140x149.png "Introduction to WebDriver & Comparison with Selenium RC") **Selenium RC 較慢,因為** **使用名為 Selenium Core 的 Javascript 程序。** 此 Selenium Core 是直接控制瀏覽器而不是您的一個。 ## 3.現實生活中的互動 ##### ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/90/93/909375f8b25b09f7d4f0aa18e994899d_258x370.png "Introduction to WebDriver & Comparison with Selenium RC") **WebDriver 以更現實的方式與頁面元素進行交互。** 例如,如果您要測試的頁面上有禁用的文本框,則 WebDriver 實際上無法像真實人無法輸入的那樣在其中輸入任何值。 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/63/b6/63b61e62cb0b03446be984ca17a02304_282x367.png "Introduction to WebDriver & Comparison with Selenium RC") 就像其他 [JavaScript](/interactive-javascript-tutorials.html) 代碼一樣,Selenium Core 可以訪問禁用的元素。 過去,Selenium 測試人員抱怨 Selenium Core 能夠在測試中向禁用的文本框輸入值。 API 的差異 ## 4\. API ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/29/a9/29a9c29fa8fd6257bf86a7891a189d87_650x555.png "Introduction to WebDriver & Comparison with Selenium RC") **Selenium RC 的 API 更成熟,但包含冗余并且經常使命令混亂**。 例如,大多數時候,測試人員對于使用 type 還是 typeKeys 感到困惑。 還是使用 click,mouseDown 或 mouseDownAt。 更糟糕的是,**不同的瀏覽器也以不同的方式解釋這些命令中的每一個!** **WebDriver 的 API 比 Selenium RC 的**更簡單。 它不包含冗余和混亂的命令。 ## 5.瀏覽器支持 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/36/2d/362de5f337c7d750376214ccdf4501fa_343x409.png "Introduction to WebDriver & Comparison with Selenium RC") **WebDriver 可以支持無頭 HtmlUnit 瀏覽器** HtmlUnit 被稱為“無頭”,因為它是不可見的瀏覽器-無 GUI。 這是一個非常快速的瀏覽器,因為沒有時間花費在等待頁面元素加載上。 這樣可以加快測試執行周期。 由于它對用戶不可見,因此只能通過自動方式進行控制。 **Selenium RC 無法支持無頭 HtmlUnit 瀏覽器。** 它需要一個真實可見的瀏覽器才能進行操作。 ## WebDriver 的局限性 ### WebDriver 無法立即支持新的瀏覽器 請記住,WebDriver 在操作系統級別上運行。 另外,請記住,不同的瀏覽器以不同的方式與操作系統通信。 如果出現新的瀏覽器,與其他瀏覽器相比,它與操作系統進行通信的過程可能會有所不同。 因此,**您必須給 WebDriver 團隊一些時間來弄清楚**的新過程,然后他們才能在下一個 WebDriver 版本中實現它。 但是,由 WebDriver 的開發人員團隊決定是否應支持新的瀏覽器。 ### Selenium RC 具有內置的測試結果生成器 **Selenium RC 自動生成測試結果**的 HTML 文件。 該報告的格式由 RC 自行設置。 在下面查看此報告的示例。 ![Introduction to WebDriver & Comparison with Selenium RC](https://img.kancloud.cn/d3/43/d343a52e89e516ecb74e7ba85f8f5e13_370x481.png "Introduction to WebDriver & Comparison with Selenium RC") **WebDriver 沒有內置命令可自動生成測試結果文件**。 您將不得不依靠 IDE 的輸出窗口,或者使用編程語言的功能自己設計報告并將其存儲為文本,HTML 等。 ## 摘要 * WebDriver 是用于使用不同的編程語言在不同的瀏覽器中測試 Web 應用程序**的工具。** * 現在,您可以進行強大的測試,因為 WebDriver **允許您在設計測試時使用選擇的編程語言**。 * WebDriver 的結構更簡單,因此它比 Selenium RC 的**更快。** * WebDriver **直接與瀏覽器**通信,而 Selenium RC 需要 RC Server 的幫助。 * 與 Selenium RC 相比,WebDriver 的 API 更簡潔。 * WebDriver **可以支持 HtmlUnit** ,而 Selenium RC 無法。 * WebDriver 的唯一缺點是: * 它**無法隨時支持新的瀏覽器**,但 Selenium RC 可以。 * 它**沒有內置命令**用于自動生成測試結果。
                  <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>

                              哎呀哎呀视频在线观看