<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## Pushing/Pulling 文件 Appium 提供了[Pull 目錄](http://appium.io../commands/device/files/pull-folder/), [Pull 文件](http://appium.io../commands/device/files/pull-file/) 和 [Push 文件](http://appium.io../commands/device/files/push-file/) 三個命令來移動文件。 本文檔旨在幫助理解它們是如何工作的。 ### 命令使用格式 #### 名詞解釋: bundle_id:bundle ID可以翻譯成包ID,也可以叫APP ID 或應用ID,它是每一個ios應用的全球唯一標識。無論代碼怎么改,圖標和應用名稱怎么換,只要bundle id沒變,ios系統就認為這是同一個應用。每開發一個新應用,首先都需要到member center->identifier->APP IDS去創建一個bundle id。 container:每一個App都被放在沙盒(sandbox)中,在沙盒中,有一個Containers,Containers又被分為Bundle Container和Data Container 基本格式如下: 1. `@<app_bundle_id>:<optional_container_type>/<文件或者目錄在container里的路徑>` 2. `@<app_bundle_id>/<文件或者目錄在container里的路徑>` 3. `<文件或者目錄在container里的路徑>` ### 真機 #### 命令使用格式 以下是該方法參數的格式: 針對上面說的基本格式 - `@<app_bundle_id>` 是應用的 bundle identifier - `optional_container_type` 是 container 類型 - `documents` 是唯一選項 - 你可以通過`ifuse -u <udid> --list-apps`得到 bundle id列表,然后給列表中的bundle id指定 container 類型為`documents`。 - 比如下面的 _On My iPhone_ 圖中有 _Slack_ 目錄,但是在 `--list-apps` 中并不存在 `com.tinyspeck.chatlyio` 。所以我們就無法加載`com.tinyspeck.chatlyio@documents/` <img src='../writing-running-appium/ios/ios-xctest-file-movement/on_my_iphone.png' width=100> - 你也可以不指定container類型,比如 _格式 2_ - 只有應用的`info.plist`里有 `UIFileSharingEnabled` 標簽才可以加載。 - `文件或者目錄在container里的路徑` 指的是pull/push文件或者目錄的目標。 - 如果 `optional_container_type` 是 `documents`,那么這個路徑可以映射為`Files`應用中的`On My iPhone/<app name>` 真機中不允許使用 _格式 3_ #### 示例 如果你想從 keynote 應用中把 _Presentation.key_ 拉到本地,你可以這樣做: - Pull file ```javascript // webdriver.io let data = driver.pullFile('@io.appium.example:documents/Presentation.key'); await fs.writeFile('presentation.key', Buffer.from(data, 'base64'), 'binary'); ``` ```ruby # ruby_lib_core file = @driver.pull_file '@com.apple.Keynote:documents/Presentation.key' File.open('presentation.key', 'wb') { |f| f<< file } ``` 該文件在 _Files_ 應用中的 _On My iPhone/Keynote_. |Top | On My iPhone | Keynote | |:----:|:----:|:----:| |![](../writing-running-appium/ios/ios-xctest-file-movement/top_files.png)|![](../writing-running-appium/ios/ios-xctest-file-movement/on_my_iphone.png)|![](../writing-running-appium/ios/ios-xctest-file-movement/keynote.png)| 如果文件目錄比較深,比如 _On My iPhone/Keynote/Dir1/Dir2_,那么代碼命令如下: ```javascript // webdriver.io let data = driver.pullFile('@io.appium.example:documents/Dir1/Dir2/Presentation.key'); await fs.writeFile('presentation.key', Buffer.from(data, 'base64'), 'binary'); ``` ```ruby # ruby_lib_core file = @driver.pull_file '@com.apple.Keynote:documents/Dir1/Dir2/Presentation.key' File.open('presentation.key', 'wb') { |f| f<< file } ``` - Pull 目錄 如果你要把 _On My iPhone/Keynote_ 拉到本地,你可以這樣做: `@driver.pull_folder '@com.apple.Keynote:documents/'`。 ```javascript // webdriver.io let data = driver.pullFolder('@io.appium.example:documents/'); await fs.writeFile('documents.zip', Buffer.from(data, 'base64'), 'binary'); ``` ```ruby # ruby_lib_core file = @driver.pull_folder '@com.apple.Keynote:documents/' File.open('documents.zip', 'wb') { |f| f<< file } ``` - Push 文件 和 pull 文件一樣 ```javascript // webdriver.io driver.pushFile('@com.apple.Keynote:documents/text.txt', new Buffer("Hello World").toString('base64')); ``` ```ruby # ruby_lib_core @driver.push_file '@com.apple.Keynote:documents/text.txt', (File.read 'path/to/file') ``` ### 模擬器 #### 格式 參數格式如下: 針對上面說的基本格式 - `@<app_bundle_id>` - `optional_container_type` 可選的容器類型 - `app`, `data`, `groups` 或者 `<A specific App Group container>` - 如果不指定的話,默認使用 `app` container - `文件或者目錄在container里的路徑` _格式 3_ 只能處理 `app` container #### 示例 ```java // Java // Get AddressBook.sqlitedb in test app package ('app' container) byte[] fileContent = driver.pullFile("Library/AddressBook/AddressBook.sqlitedb"); Path dstPath = Paths.get(new File("/local/path/AddressBook.sqlitedb")); Files.write(dstPath, fileContent); ``` ### 參考 - https://stackoverflow.com/questions/1108076/where-does-the-iphone-simulator-store-its-data - https://stackoverflow.com/questions/48884248/how-can-i-add-files-to-the-ios-simulator - https://apple.stackexchange.com/questions/299413/how-to-allow-the-files-app-to-save-to-on-my-iphone-or-to-on-my-ipad-in-ios/299565#299565
                  <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>

                              哎呀哎呀视频在线观看