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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 獲得頁面源碼 獲取描述當前應用的層級結構的XML(app)或者頁面源碼(web) ## 使用樣例 ```java // Java String pageSource = driver.getPageSource(); ``` ```python # Python source = self.driver.page_source ``` ```javascript // Javascript // webdriver.io example let source = driver.getPageSource(); // wd example let pageSource = await driver.source(); ``` ```ruby # Ruby # ruby_lib example page_source # ruby_lib_core example @driver.page_source ``` ```php # PHP // TODO PHP sample ``` ```csharp // C# string pageSource = driver.PageSource; ``` ## 描述 在web環境中,source方法返回的是當前窗口的HTML源碼。在原生環境(iOS, Android, etc...) 中,source方法返回的是描述應用層級結構的XML。 這個方法對于檢查你的應用的層級結構(hierarchy )并利用結構來寫[選擇器](../../commands/element/find-element.md)是有幫助的。 (注意:iOS和Android沒有標準方式來定義各自應用源碼,所以在調用“獲取頁面源碼”的方法時 ,Appium會遍歷應用程序的層次結構(hierarchy)并創建一個XML文檔。因此,獲取源碼操作通常是一項開銷很大而且耗時的操作。) ## 支持 ### Appium Server | 平臺 | Driver | 平臺版本 | Appium版本 | Driver版本 | |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../../drivers/ios-xcuitest.md) | 9.3+ | 1.6.0+ | All | | | [UIAutomation](../../drivers/ios-uiautomation.md) | 8.0 to 9.3 | All | All | | Android | [Espresso](../../drivers/android-espresso.md) | ?+ | 1.9.0+ | All | | | [UiAutomator2](../../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | All | | | [UiAutomator](../../drivers/android-uiautomator.md) | 4.3+ | All | All | | Mac | [Mac](../../drivers/mac.md) | ?+ | 1.6.4+ | All | | Windows | [Windows](../../drivers/windows.md) | 10+ | 1.6.0+ | All | ### Appium客戶端 | 語言 | 支持版本 | 文檔 | |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| All | [seleniumhq.github.io](https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/remote/RemoteWebDriver.html#getPageSource--) | |[Python](https://github.com/appium/python-client/releases/latest)| All | [selenium-python.readthedocs.io](http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.page_source) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| All | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| All | [github.com](https://github.com/admc/wd/blob/master/lib/commands.js#L1808) | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| All | [www.rubydoc.info](https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Driver:page_source) | |[PHP](https://github.com/appium/php-client/releases/latest)| All | [github.com](https://github.com/appium/php-client/) | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| All | [github.com](https://github.com/appium/appium-dotnet-driver/) | ## HTTP API 規范 ### 終端 `GET /session/:session_id/source` ### URL參數 | 名稱 | 描述 | |----|-----------| |session_id|將指令發往的會話(session)的ID| ### JSON參數 None ### 響應 當前環境的源碼 (`string`) ## 參考 * [W3C Specification](https://www.w3.org/TR/webdriver/#dfn-get-page-source) * [JSONWP Specification](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidsource) 本文由 [KangarooChen](https://github.com/KangarooChen) 翻譯,Last english version: d05573600bb3ef2663a9c1e37a02c2ff5ec62155, 31 Dec 2019
                  <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>

                              哎呀哎呀视频在线观看