Wait Until File Is Uploaded to Disk Django

Exam File Upload Functionality

Test your web app's file upload functionality on BrowserStack Automate.

Introduction

This document guides you on how to test your web app'south File Upload functionality in Automate by:

  • Uploading files from your machine
  • Uploading pre-loaded files
  • Uploading files that are downloaded in the same automate session

Supported Browsers and Operating Systems

Component List
Supported OS All desktop and mobile Os
Supported Browser All (Chrome, Firefox, Safari, IE, Border)

Uploading files from your auto

You lot can transport a file to remote browsers—directly from your workstation—in Automate, through the LocalFileDetector method.

                                                  import                          org.openqa.selenium.By                          ;                          import                          org.openqa.selenium.JavascriptExecutor                          ;                          import                          org.openqa.selenium.remote.DesiredCapabilities                          ;                          import                          org.openqa.selenium.remote.LocalFileDetector                          ;                          import                          org.openqa.selenium.remote.RemoteWebDriver                          ;                          import                          org.openqa.selenium.support.ui.ExpectedConditions                          ;                          import                          org.openqa.selenium.support.ui.WebDriverWait                          ;                          public                          class                          JavaSample                          {                          public                          static                          final                          String                          AUTOMATE_USERNAME                          =                          "YOUR_USERNAME"                          ;                          public                          static                          final                          String                          AUTOMATE_KEY                          =                          "YOUR_ACCESS_KEY"                          ;                          public                          static                          final                          String                          URL                          =                          "https://"                          +                          AUTOMATE_USERNAME                          +                          ":"                          +                          AUTOMATE_KEY                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ;                          public                          static                          void                          main                          (                          String                          []                          args                          )                          throws                          Exception                          {                          DesiredCapabilities                          caps                          =                          new                          DesiredCapabilities                          ();                          caps                          .                          setCapability                          (                          "browser"                          ,                          "internet explorer"                          );                          caps                          .                          setCapability                          (                          "os"                          ,                          "windows"                          );                          caps                          .                          setCapability                          (                          "browser_version"                          ,                          "11.0"                          );                          caps                          .                          setCapability                          (                          "os_version"                          ,                          "10"                          );                          caps                          .                          setCapability                          (                          "browserstack.sendKeys"                          ,                          "true"                          );                          caps                          .                          setCapability                          (                          "browserstack.debug"                          ,                          "truthful"                          );                          caps                          .                          setCapability                          (                          "name"                          ,                          "Bstack-[Java] Sample Test"                          );                          RemoteWebDriver                          driver                          =                          new                          RemoteWebDriver                          (                          new                          URL                          (                          URL                          ),                          caps                          );                          driver                          .                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          commuter                          .                          get                          (                          "http://www.fileconvoy.com/"                          );                          driver                          .                          findElement                          (                          By                          .                          id                          (                          "upfile_0"                          )).                          sendKeys                          (                          "//local//file//path"                          );                          commuter                          .                          findElement                          (                          Past                          .                          id                          (                          "readTermsOfUse"                          )).                          click                          ();                          driver                          .                          findElement                          (                          By                          .                          proper noun                          (                          "upload_button"                          )).                          submit                          ();                          JavascriptExecutor                          jse                          =                          (                          JavascriptExecutor                          )                          driver                          ;                          attempt                          {                          WebDriverWait                          await                          =                          new                          WebDriverWait                          (                          driver                          ,                          five                          );                          wait                          .                          until                          (                          ExpectedConditions                          .                          presenceOfElementLocated                          (                          By                          .                          id                          (                          "TopMessage"                          )));                          if                          (                          driver                          .                          findElementById                          (                          "TopMessage"                          ).                          getText                          ().                          contains                          (                          "successfully uploaded"                          ))                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"passed\", \"reason\": \"File uploaded successfully\"}}"                          );                          }                          else                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"activeness\": \"setSessionStatus\", \"arguments\": {\"condition\": \"failed\", \"reason\": \"File upload failed\"}}"                          );                          }                          }                          grab                          (                          Exception                          e                          )                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File could not be uploaded in v seconds\"}}"                          );                          }                          commuter                          .                          quit                          ();                          }                          }                                              
                                                  const                          webdriver                          =                          require                          (                          "                          selenium-webdriver                          "                          );                          const                          remote                          =                          require                          (                          "                          selenium-webdriver/remote                          "                          );                          // Input capabilities                          const                          capabilities                          =                          {                          "                          browserName                          "                          :                          "                          Internet Explorer                          "                          ,                          "                          browser_version                          "                          :                          "                          eleven.0                          "                          ,                          "                          os                          "                          :                          "                          Windows                          "                          ,                          "                          os_version                          "                          :                          "                          10                          "                          ,                          "                          name                          "                          :                          "                          Bstack-[NodeJS] Upload Test                          "                          ,                          "                          browserstack.sendKeys                          "                          :                          "                          true                          "                          ,                          "                          browserstack.debug                          "                          :                          "                          truthful                          "                          ,                          "                          browserstack.user                          "                          :                          "                          YOUR_USERNAME                          "                          ,                          "                          browserstack.key                          "                          :                          "                          YOUR_ACCESS_KEY                          "                          };                          const                          driver                          =                          new                          webdriver                          .                          Builder                          ()                          .                          usingServer                          (                          "                          https://hub-cloud.browserstack.com/wd/hub                          "                          )                          .                          withCapabilities                          (                          capabilities                          )                          .                          build                          ();                          //This will discover your local file                          driver                          .                          setFileDetector                          (                          new                          remote                          .                          FileDetector                          ());                          (                          async                          ()                          =>                          {                          wait                          driver                          .                          get                          (                          "                          http://www.fileconvoy.com                          "                          );                          const                          filePathElement                          =                          await                          driver                          .                          findElement                          (                          webdriver                          .                          Past                          .                          id                          (                          "                          upfile_0                          "                          ));                          await                          filePathElement                          .                          sendKeys                          (                          "                          //local//file//path                          "                          );                          await                          (                          await                          commuter                          .                          findElement                          (                          webdriver                          .                          Past                          .                          id                          (                          "                          readTermsOfUse                          "                          ))).                          click                          ();                          wait                          (                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          name                          (                          "                          upload_button                          "                          ))).                          click                          ();                          try                          {                          await                          commuter                          .                          wait                          (                          webdriver                          .                          until                          .                          elementIsVisible                          ((                          look                          commuter                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )))),                          5000                          );                          if                          ((                          await                          commuter                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )).                          getText                          ()).                          includes                          (                          '                          successfully uploaded                          '                          ))                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"passed","reason": "File upload successful"}}                          '                          );                          }                          else                          {                          wait                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "File upload failed"}}                          '                          );                          }                          }                          catch                          (                          e                          )                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"activeness": "setSessionStatus", "arguments": {"status":"failed","reason": "File could not be uploaded in fourth dimension"}}                          '                          );                          }                          await                          driver                          .                          quit                          ();                          })();                                              
                                                  using                          System                          ;                          using                          System.Text                          ;                          using                          OpenQA.Selenium                          ;                          using                          OpenQA.Selenium.Remote                          ;                          namespace                          SeleniumTest                          {                          class                          Plan                          {                          static                          void                          Main                          (                          string                          []                          args                          )                          {                          Encoding                          .                          RegisterProvider                          (                          CodePagesEncodingProvider                          .                          Case                          );                          IWebDriver                          commuter                          ;                          OpenQA                          .                          Selenium                          .                          IE                          .                          InternetExplorerOptions                          capability                          =                          new                          OpenQA                          .                          Selenium                          .                          IE                          .                          InternetExplorerOptions                          ();                          capability                          .                          AddAdditionalCapability                          (                          "browser"                          ,                          "IE"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browser_version"                          ,                          "11"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "bone"                          ,                          "Windows"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "os_version"                          ,                          "10"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.sendKeys"                          ,                          "true"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.debug"                          ,                          "true"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.user"                          ,                          "YOUR_USERNAME"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.key"                          ,                          "YOUR_ACCESS_KEY"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "name"                          ,                          "Bstack-[C_sharp] Sample Test"                          ,                          true                          );                          driver                          =                          new                          RemoteWebDriver                          (                          new                          Uri                          (                          "http://hub-cloud.browserstack.com/wd/hub/"                          ),                          capability                          );                          driver                          .                          Navigate                          ().                          GoToUrl                          (                          "http://www.fileconvoy.com"                          );                          IWebElement                          uploadFile                          =                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upfile_0"                          ));                          Console                          .                          WriteLine                          (                          driver                          .                          Title                          );                          String                          path                          =                          "//path//to//your//local//file"                          ;                          //File path in your local machine                          LocalFileDetector                          detector                          =                          new                          LocalFileDetector                          ();                          var                          allowsDetection                          =                          driver                          every bit                          IAllowsFileDetection                          ;                          if                          (                          allowsDetection                          !=                          nada                          )                          {                          allowsDetection                          .                          FileDetector                          =                          detector                          ;                          }                          uploadFile                          .                          SendKeys                          (                          path                          );                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "readTermsOfUse"                          )).                          Click                          ();                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upload_button"                          )).                          Click                          ();                          driver                          .                          Manage                          ().                          Timeouts                          ().                          ImplicitWait                          =                          TimeSpan                          .                          FromSeconds                          (                          5                          );                          if                          (                          driver                          .                          FindElement                          (                          By                          .                          CssSelector                          (                          "#TopMessage"                          )).                          Text                          .                          Contains                          (                          "successfully uploaded"                          ))                          {                          ((                          IJavaScriptExecutor                          )                          driver                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \"File uploaded successfully!\"}}"                          );                          }                          else                          {                          ((                          IJavaScriptExecutor                          )                          driver                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \"File upload failed!\"}}"                          );                          }                          driver                          .                          Quit                          ();                          }                          }                          }                                              
                                                  <?php                          require_once                          (                          'vendor/autoload.php'                          );                          use                          Facebook\WebDriver\Remote\RemoteWebDriver                          ;                          utilize                          Facebook\WebDriver\WebDriverBy                          ;                          use                          Facebook\WebDriver\Remote\LocalFileDetector                          ;                          $caps                          =                          array                          (                          "browser"                          =>                          "Internet Explorer"                          ,                          "browser_version"                          =>                          "11.0"                          ,                          "os"                          =>                          "Windows"                          ,                          "os_version"                          =>                          "10"                          ,                          "browserstack.sendKeys"                          =>                          "true"                          ,                          "proper noun"                          =>                          "Bstack-[Php] Sample Test"                          ,                          "browserstack.debug"                          =>                          "true"                          ,                          "pageLoadStrategy"                          =>                          'none'                          );                          $web_driver                          =                          RemoteWebDriver                          ::                          create                          (                          "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          $caps                          );                          $web_driver                          ->                          get                          (                          "http://www.fileconvoy.com"                          );                          $file_input                          =                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "upfile_0"                          ));                          $file_input                          ->                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          $file_input                          ->                          sendKeys                          (                          "//local//file//path"                          );                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "readTermsOfUse"                          ))                          ->                          click                          ();                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          proper name                          (                          "upload_button"                          ))                          ->                          submit                          ();                          sleep                          (                          5                          );                          $web_driver                          ->                          quit                          ();                          ?>                                              
                                                  from                          selenium                          import                          webdriver                          from                          selenium.webdriver.common.keys                          import                          Keys                          from                          selenium.webdriver.common.desired_capabilities                          import                          DesiredCapabilities                          from                          selenium.mutual.exceptions                          import                          TimeoutException                          from                          selenium.webdriver.support.ui                          import                          WebDriverWait                          desired_cap                          =                          {                          'browser'                          :                          'Internet Explorer'                          ,                          'browser_version'                          :                          'eleven.0'                          ,                          'os'                          :                          'Windows'                          ,                          'os_version'                          :                          '10'                          ,                          'browserstack.sendKeys'                          :                          'true'                          ,                          'browserstack.debug'                          :                          'truthful'                          ,                          'name'                          :                          'Bstack-[Python] Sample Test'                          }                          driver                          =                          webdriver                          .                          Remote                          (                          command_executor                          =                          'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.browserstack.com/wd/hub'                          ,                          desired_capabilities                          =                          desired_cap                          )                          driver                          .                          get                          (                          'http://www.fileconvoy.com'                          )                          driver                          .                          find_element_by_id                          (                          'upfile_0'                          ).                          send_keys                          (                          '//local//file//path'                          )                          driver                          .                          find_element_by_id                          (                          'readTermsOfUse'                          ).                          click                          ()                          commuter                          .                          find_element_by_name                          (                          'upload_button'                          ).                          submit                          ()                          attempt                          :                          WebDriverWait                          (                          driver                          ,                          v                          ).                          until                          (                          lambda                          ten                          :                          10                          .                          find_element_by_id                          (                          'TopMessage'                          ))                          if                          (                          driver                          .                          find_element_by_id                          (                          'TopMessage'                          ).                          text                          ==                          "Your file(s) take been successfully uploaded."                          ):                          # Setting the condition of test as 'passed' or 'failed' based on the condition; if championship of the web folio starts with 'BrowserStack'                                                    driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed", "reason": "File uploaded!"}}'                          )                          else                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "File upload failed"}}'                          )                          except                          TimeoutException                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "File failed to upload in 5 seconds"}}'                          )                          driver                          .                          quit                          ()                                              
                                                  require                          'rubygems'                          require                          'selenium-webdriver'                          # Input capabilities                          caps                          =                          Selenium                          ::                          WebDriver                          ::                          Remote                          ::                          Capabilities                          .                          new                          caps                          [                          'browser'                          ]                          =                          'Cyberspace Explorer'                          caps                          [                          'browser_version'                          ]                          =                          'eleven.0'                          caps                          [                          'os'                          ]                          =                          'Windows'                          caps                          [                          'os_version'                          ]                          =                          '10'                          caps                          [                          'name'                          ]                          =                          'Bstack-[Reddish] Sample Test'                          caps                          [                          'browserstack.sendKeys'                          ]                          =                          'true'                          caps                          [                          'browserstack.debug'                          ]                          =                          'true'                          caps                          [                          "javascriptEnabled"                          ]                          =                          'true'                          #Enabling the javascriptEnabled capability to execute javascript in the examination script                          driver                          =                          Selenium                          ::                          WebDriver                          .                          for                          (                          :remote                          ,                          :url                          =>                          "http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-deject.browserstack.com/wd/hub"                          ,                          :desired_capabilities                          =>                          caps                          )                          commuter                          .                          file_detector                          =                          lambda                          do                          |                          args                          |                          str                          =                          args                          .                          first                          .                          to_s                          str                          if                          File                          .                          exist?                          (                          str                          )                          end                          commuter                          .                          navigate                          .                          to                          "http://www.fileconvoy.com"                          driver                          .                          find_element                          (                          :id                          ,                          "upfile_0"                          ).                          send_keys                          (                          "//local//file//path"                          )                          commuter                          .                          execute_script                          (                          'document.getElementById("readTermsOfUse").click();'                          )                          driver                          .                          find_element                          (                          :name                          ,                          "upload_button"                          ).                          submit                          sleep                          (                          five                          )                          driver                          .                          quit                                              
                                                  utilise                          Selenium::Remote::                          Driver                          ;                          #Input capabilities                          my                          $extraCaps                          =                          {                          "                          browser                          "                          =>                          "                          Internet Explorer                          ",                          "                          browser_version                          "                          =>                          "                          xi.0                          ",                          "                          os                          "                          =>                          "                          Windows                          ",                          "                          os_version                          "                          =>                          "                          x                          ",                          "                          browserstack.sendKeys                          "                          =>                          "                          true                          ",                          "                          browserstack.debug                          "                          =>                          "                          true                          ",                          "                          proper name                          "                          =>                          "                          Bstack-[Perl] Sample Test                          "                          };                          my                          $login                          =                          "                          YOUR_USERNAME                          ";                          my                          $primal                          =                          "                          YOUR_ACCESS_KEY                          ";                          my                          $host                          =                          "                          $login                          :                          $key                          \@                          hub-deject.browserstack.com                          ";                          my                          $commuter                          =                          new                          Selenium::Remote::                          Driver                          ('                          remote_server_addr                          '                          =>                          $host                          ,                          '                          port                          '                          =>                          '                          80                          ',                          '                          extra_capabilities                          '                          =>                          $extraCaps                          );                          my                          $remote_fname                          =                          $commuter                          ->                          upload_file                          ("                          //local//file//path                          ");                          $driver                          ->                          become                          ('                          http://www.fileconvoy.com                          ');                          $driver                          ->                          find_element                          ('                          upfile_0                          ','                          id                          ')                          ->                          send_keys                          (                          $remote_fname                          );                          $driver                          ->                          find_element                          ('                          readTermsOfUse                          ',                          '                          id                          ')                          ->                          click                          ();                          $driver                          ->                          find_element                          ('                          upload_button                          ',                          '                          proper noun                          ')                          ->                          click                          ();                          slumber                          40                          ;                          $driver                          ->                          quit                          ();                                              

Note: Other browsers include Chrome, Firefox, Edge and Safari browsers.

You tin send a file to remote browsers—directly from your workstation—in Automate, through the LocalFileDetector method.

                                                  import                          org.openqa.selenium.By                          ;                          import                          org.openqa.selenium.JavascriptExecutor                          ;                          import                          org.openqa.selenium.remote.DesiredCapabilities                          ;                          import                          org.openqa.selenium.remote.LocalFileDetector                          ;                          import                          org.openqa.selenium.remote.RemoteWebDriver                          ;                          import                          org.openqa.selenium.support.ui.ExpectedConditions                          ;                          import                          org.openqa.selenium.support.ui.WebDriverWait                          ;                          import                          coffee.cyberspace.URL                          ;                          public                          class                          JavaSample                          {                          public                          static                          final                          String                          AUTOMATE_USERNAME                          =                          "YOUR_USERNAME"                          ;                          public                          static                          final                          Cord                          AUTOMATE_KEY                          =                          "YOUR_ACCESS_KEY"                          ;                          public                          static                          final                          String                          URL                          =                          "https://"                          +                          AUTOMATE_USERNAME                          +                          ":"                          +                          AUTOMATE_KEY                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ;                          public                          static                          void                          principal                          (                          String                          []                          args                          )                          throws                          Exception                          {                          DesiredCapabilities                          caps                          =                          new                          DesiredCapabilities                          ();                          caps                          .                          setCapability                          (                          "browser"                          ,                          "chrome"                          );                          caps                          .                          setCapability                          (                          "bone"                          ,                          "windows"                          );                          caps                          .                          setCapability                          (                          "browser_version"                          ,                          "latest"                          );                          caps                          .                          setCapability                          (                          "os_version"                          ,                          "ten"                          );                          caps                          .                          setCapability                          (                          "name"                          ,                          "Bstack-[Java] Sample Test"                          );                          WebDriver                          driver                          =                          new                          RemoteWebDriver                          (                          new                          URL                          (                          URL                          ),                          caps                          );                          driver                          .                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          commuter                          .                          get                          (                          "http://www.fileconvoy.com/"                          );                          driver                          .                          findElement                          (                          Past                          .                          id                          (                          "upfile_0"                          )).                          sendKeys                          (                          "//local//file//path"                          );                          driver                          .                          findElement                          (                          By                          .                          id                          (                          "readTermsOfUse"                          )).                          click                          ();                          commuter                          .                          findElement                          (                          Past                          .                          name                          (                          "upload_button"                          )).                          submit                          ();                          JavascriptExecutor                          jse                          =                          (                          JavascriptExecutor                          )                          driver                          ;                          try                          {                          WebDriverWait                          wait                          =                          new                          WebDriverWait                          (                          driver                          ,                          5                          );                          expect                          .                          until                          (                          ExpectedConditions                          .                          presenceOfElementLocated                          (                          By                          .                          id                          (                          "TopMessage"                          )));                          if                          (                          commuter                          .                          findElementById                          (                          "TopMessage"                          ).                          getText                          ().                          contains                          (                          "successfully uploaded"                          ))                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"passed\", \"reason\": \"File uploaded successfully\"}}"                          );                          }                          else                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File upload failed\"}}"                          );                          }                          }                          grab                          (                          Exception                          eastward                          )                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File could not be uploaded in 5 seconds\"}}"                          );                          }                          driver                          .                          quit                          ();                          }                          }                                              
                                                  const                          webdriver                          =                          require                          (                          '                          selenium-webdriver                          '                          );                          const                          fs                          =                          require                          (                          '                          fs                          '                          );                          const                          remote                          =                          require                          (                          '                          selenium-webdriver/remote                          '                          );                          // Input capabilities                          const                          capabilities                          =                          {                          '                          browserName                          '                          :                          '                          safari                          '                          ,                          '                          browser_version                          '                          :                          '                          latest                          '                          ,                          '                          os                          '                          :                          '                          Os X                          '                          ,                          '                          os_version                          '                          :                          '                          Big Sur                          '                          ,                          '                          proper name                          '                          :                          '                          Safari test file upload                          '                          ,                          // test proper noun                          '                          build                          '                          :                          '                          File upload testing                          '                          // Build name                          }                          async                          function                          runTestWithCaps                          ()                          {                          let                          driver                          =                          new                          webdriver                          .                          Architect                          ()                          .                          usingServer                          (                          '                          http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub                          '                          )                          .                          withCapabilities                          (                          capabilities                          )                          .                          build                          ();                          //This volition detect your local file                          await                          commuter                          .                          setFileDetector                          (                          new                          remote                          .                          FileDetector                          );                          await                          commuter                          .                          get                          (                          '                          http://www.fileconvoy.com/                          '                          );                          await                          commuter                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          upfile_0                          '                          )).                          sendKeys                          (                          '                          //path//to//your//local//file                          '                          );                          // Path to teh file in your system needs to be given here                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          readTermsOfUse                          '                          )).                          click                          ();                          await                          commuter                          .                          findElement                          (                          webdriver                          .                          Past                          .                          id                          (                          '                          upload_button                          '                          )).                          click                          ();                          wait                          driver                          .                          wait                          (                          webdriver                          .                          until                          .                          elementLocated                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )),                          5000                          );                          if                          ((                          expect                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )).                          getText                          ()).                          includes                          (                          '                          successfully uploaded                          '                          ))                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "File upload successful"}}                          '                          );                          }                          else                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "File upload failed"}}                          '                          );                          }                          await                          driver                          .                          quit                          ();                          }                          runTestWithCaps                          ();                                              
                                                  using                          System                          ;                          using                          System.Text                          ;                          using                          OpenQA.Selenium                          ;                          using                          OpenQA.Selenium.Remote                          ;                          namespace                          SeleniumTest                          {                          class                          Programme                          {                          static                          void                          Primary                          (                          string                          []                          args                          )                          {                          Encoding                          .                          RegisterProvider                          (                          CodePagesEncodingProvider                          .                          Example                          );                          IWebDriver                          commuter                          ;                          OpenQA                          .                          Selenium                          .                          Chrome                          .                          ChromeOptions                          capability                          =                          new                          OpenQA                          .                          Selenium                          .                          Chrome                          .                          ChromeOptions                          ();                          adequacy                          .                          AddAdditionalCapability                          (                          "browser"                          ,                          "Chrome"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "browser_version"                          ,                          "75.0"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "os"                          ,                          "Windows"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "os_version"                          ,                          "10"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.user"                          ,                          "YOUR_USERNAME"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.fundamental"                          ,                          "YOUR_ACCESS_KEY"                          ,                          truthful                          );                          adequacy                          .                          AddAdditionalCapability                          (                          "proper name"                          ,                          "Bstack-[C_sharp] Sample Examination"                          ,                          truthful                          );                          driver                          =                          new                          RemoteWebDriver                          (                          new                          Uri                          (                          "http://hub-deject.browserstack.com/wd/hub/"                          ),                          adequacy                          );                          driver                          .                          Navigate                          ().                          GoToUrl                          (                          "http://www.fileconvoy.com"                          );                          IWebElement                          uploadFile                          =                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upfile_0"                          ));                          Panel                          .                          WriteLine                          (                          driver                          .                          Title                          );                          String                          path                          =                          "path//to//your//local//file"                          ;                          //File path in your local automobile                          LocalFileDetector                          detector                          =                          new                          LocalFileDetector                          ();                          var                          allowsDetection                          =                          driver                          as                          IAllowsFileDetection                          ;                          if                          (                          allowsDetection                          !=                          nothing                          )                          {                          allowsDetection                          .                          FileDetector                          =                          detector                          ;                          }                          uploadFile                          .                          SendKeys                          (                          path                          );                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "readTermsOfUse"                          )).                          Click                          ();                          driver                          .                          FindElement                          (                          Past                          .                          Id                          (                          "upload_button"                          )).                          Click                          ();                          driver                          .                          Manage                          ().                          Timeouts                          ().                          ImplicitWait                          =                          TimeSpan                          .                          FromSeconds                          (                          5                          );                          String                          result                          =                          driver                          .                          FindElement                          (                          By                          .                          CssSelector                          (                          "#TopMessage"                          )).                          Text                          ;                          if                          (                          outcome                          .                          Contains                          (                          "successfully uploaded"                          ))                          {                          ((                          IJavaScriptExecutor                          )                          driver                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"activeness\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \"File uploaded successfully!\"}}"                          );                          }                          else                          {                          ((                          IJavaScriptExecutor                          )                          driver                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"condition\":\"failed\", \"reason\": \"File upload failed!\"}}"                          );                          }                          driver                          .                          Quit                          ();                          }                          }                          }                                              
                                                  <?php                          require_once                          (                          'vendor/autoload.php'                          );                          use                          Facebook\WebDriver\Remote\RemoteWebDriver                          ;                          employ                          Facebook\WebDriver\WebDriverBy                          ;                          use                          Facebook\WebDriver\Remote\LocalFileDetector                          ;                          $caps                          =                          array                          (                          "browser"                          =>                          "Chrome"                          ,                          "browser_version"                          =>                          "75.0"                          ,                          "os"                          =>                          "Windows"                          ,                          "os_version"                          =>                          "10"                          ,                          "proper name"                          =>                          "Bstack-[Php] Sample Examination"                          );                          $web_driver                          =                          RemoteWebDriver                          ::                          create                          (                          "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          $caps                          );                          $web_driver                          ->                          get                          (                          "http://www.fileconvoy.com"                          );                          $file_input                          =                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "upfile_0"                          ));                          $file_input                          ->                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          $file_input                          ->                          sendKeys                          (                          "//local//file//path"                          );                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "readTermsOfUse"                          ))                          ->                          click                          ();                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          proper name                          (                          "upload_button"                          ))                          ->                          submit                          ();                          sleep                          (                          5                          );                          $web_driver                          ->                          quit                          ();                          ?>                                              
                                                  from                          selenium                          import                          webdriver                          from                          selenium.webdriver.common.keys                          import                          Keys                          from                          selenium.webdriver.mutual.desired_capabilities                          import                          DesiredCapabilities                          from                          selenium.common.exceptions                          import                          TimeoutException                          from                          selenium.webdriver.support.ui                          import                          WebDriverWait                          desired_cap                          =                          {                          'browser'                          :                          'Chrome'                          ,                          'browser_version'                          :                          '75.0'                          ,                          'os'                          :                          'Windows'                          ,                          'os_version'                          :                          '10'                          ,                          'name'                          :                          'Bstack-[Python] Sample Exam'                          }                          driver                          =                          webdriver                          .                          Remote                          (                          command_executor                          =                          'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.browserstack.com/wd/hub'                          ,                          desired_capabilities                          =                          desired_cap                          )                          driver                          .                          get                          (                          'http://www.fileconvoy.com'                          )                          driver                          .                          find_element_by_id                          (                          'upfile_0'                          ).                          send_keys                          (                          '//local//file//path'                          )                          driver                          .                          find_element_by_id                          (                          'readTermsOfUse'                          ).                          click                          ()                          driver                          .                          find_element_by_name                          (                          'upload_button'                          ).                          submit                          ()                          attempt                          :                          WebDriverWait                          (                          driver                          ,                          5                          ).                          until                          (                          lambda                          x                          :                          x                          .                          find_element_by_id                          (                          'TopMessage'                          ))                          if                          (                          commuter                          .                          find_element_by_id                          (                          'TopMessage'                          ).                          text                          ==                          "Your file(s) take been successfully uploaded."                          ):                          # Setting the condition of examination as 'passed' or 'failed' based on the condition; if title of the spider web page starts with 'BrowserStack'                                                    driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"passed", "reason": "File uploaded!"}}'                          )                          else                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"failed", "reason": "File upload failed"}}'                          )                          except                          TimeoutException                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"failed", "reason": "File failed to upload in 5 seconds"}}'                          )                          driver                          .                          quit                          ()                                              
                                                  require                          'rubygems'                          require                          'selenium-webdriver'                          # Input capabilities                          caps                          =                          Selenium                          ::                          WebDriver                          ::                          Remote                          ::                          Capabilities                          .                          new                          caps                          [                          'browser'                          ]                          =                          'Chrome'                          caps                          [                          'browser_version'                          ]                          =                          '75.0'                          caps                          [                          'os'                          ]                          =                          'Windows'                          caps                          [                          'os_version'                          ]                          =                          '10'                          caps                          [                          'name'                          ]                          =                          'Bstack-[Ruby] Sample Test'                          driver                          =                          Selenium                          ::                          WebDriver                          .                          for                          (                          :remote                          ,                          :url                          =>                          "http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          :desired_capabilities                          =>                          caps                          )                          driver                          .                          file_detector                          =                          lambda                          do                          |                          args                          |                          str                          =                          args                          .                          first                          .                          to_s                          str                          if                          File                          .                          be?                          (                          str                          )                          end                          commuter                          .                          navigate                          .                          to                          "http://www.fileconvoy.com"                          commuter                          .                          find_element                          (                          :id                          ,                          "upfile_0"                          ).                          send_keys                          (                          "//local//file//path"                          );                          driver                          .                          find_element                          (                          :id                          ,                          "readTermsOfUse"                          ).                          click                          ;                          driver                          .                          find_element                          (                          :name                          ,                          "upload_button"                          ).                          submit                          ;                          slumber                          (                          five                          )                          driver                          .                          quit                                              
                                                  use                          Selenium::Remote::                          Driver                          ;                          #Input capabilities                          my                          $extraCaps                          =                          {                          "                          browser                          "                          =>                          "                          Chrome                          ",                          "                          browser_version                          "                          =>                          "                          75.0                          ",                          "                          os                          "                          =>                          "                          Windows                          ",                          "                          os_version                          "                          =>                          "                          10                          ",                          "                          name                          "                          =>                          "                          Bstack-[Perl] Sample Test                          "                          };                          my                          $login                          =                          "                          YOUR_USERNAME                          ";                          my                          $key                          =                          "                          YOUR_ACCESS_KEY                          ";                          my                          $host                          =                          "                          $login                          :                          $key                          \@                          hub-cloud.browserstack.com                          ";                          my                          $driver                          =                          new                          Selenium::Remote::                          Driver                          ('                          remote_server_addr                          '                          =>                          $host                          ,                          '                          port                          '                          =>                          '                          80                          ',                          '                          extra_capabilities                          '                          =>                          $extraCaps                          );                          my                          $remote_fname                          =                          $driver                          ->                          upload_file                          ("                          //local//file//path                          ");                          $commuter                          ->                          become                          ('                          http://www.fileconvoy.com                          ');                          $driver                          ->                          find_element                          ('                          upfile_0                          ','                          id                          ')                          ->                          send_keys                          (                          $remote_fname                          );                          $driver                          ->                          find_element                          ('                          readTermsOfUse                          ',                          '                          id                          ')                          ->                          click                          ();                          $driver                          ->                          find_element                          ('                          upload_button                          ',                          '                          proper noun                          ')                          ->                          click                          ();                          sleep                          40                          ;                          $commuter                          ->                          quit                          ();                                              
                                                  package                          com.browserstack                          ;                          import                          io.appium.java_client.AppiumDriver                          ;                          import                          io.appium.java_client.android.AndroidDriver                          ;                          import                          io.appium.java_client.android.AndroidElement                          ;                          import                          org.openqa.selenium.By                          ;                          import                          org.openqa.selenium.WebDriver                          ;                          import                          org.openqa.selenium.WebElement                          ;                          import                          org.openqa.selenium.remote.DesiredCapabilities                          ;                          import                          org.openqa.selenium.remote.RemoteWebDriver                          ;                          import                          java.io.File                          ;                          import                          coffee.cyberspace.URL                          ;                          public                          class                          UploadFile                          {                          public                          static                          final                          String                          USERNAME                          =                          "YOUR_USERNAME"                          ;                          public                          static                          final                          String                          AUTOMATE_KEY                          =                          "YOUR_ACCESS_KEY"                          ;                          public                          static                          terminal                          String                          URL                          =                          "http://"                          +                          USERNAME                          +                          ":"                          +                          AUTOMATE_KEY                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ;                          public                          static                          void                          main                          (                          String                          []                          args                          )                          throws                          Exception                          {                          DesiredCapabilities                          caps                          =                          new                          DesiredCapabilities                          ();                          caps                          .                          setCapability                          (                          "device"                          ,                          "Samsung Galaxy S9"                          );                          caps                          .                          setCapability                          (                          "os_version"                          ,                          "8.0"                          );                          caps                          .                          setCapability                          (                          "proper name"                          ,                          "upload"                          );                          caps                          .                          setCapability                          (                          "build"                          ,                          "Upload File"                          );                          /**uploading files**/                          AndroidDriver                          <                          WebElement                          >                          driver                          =                          new                          AndroidDriver                          <                          WebElement                          >(                          new                          URL                          (                          URL                          ),                          caps                          );                          commuter                          .                          get                          (                          "https://the-cyberspace.herokuapp.com/upload"                          );                          driver                          .                          pushFile                          (                          "/data/local/tmp/<file_name>"                          ,                          new                          File                          (                          "<local_file_path>"                          ));                          driver                          .                          findElement                          (                          By                          .                          id                          (                          "file-upload"                          )).                          sendKeys                          (                          "/information/local/tmp/<file_name>"                          );                          //Thread.sleep(2000);                          commuter                          .                          findElement                          (                          Past                          .                          id                          (                          "file-submit"                          )).                          submit                          ();                          driver                          .                          quit                          ();                          }                          }                                              
                                                  var                          wd                          =                          require                          (                          '                          wd                          '                          );                          var                          fs                          =                          crave                          (                          '                          fs                          '                          )                          var                          assert                          =                          require                          (                          '                          assert                          '                          );                          var                          asserters                          =                          wd                          .                          asserters                          ;                          desiredCaps                          =                          {                          '                          browserstack.user                          '                          :                          '                          YOUR_USERNAME                          '                          ,                          '                          browserstack.key                          '                          :                          '                          YOUR_ACCESS_KEY                          '                          ,                          '                          build                          '                          :                          '                          Node Push File                          '                          ,                          '                          proper noun                          '                          :                          '                          upload file                          '                          ,                          '                          device                          '                          :                          '                          Google Pixel 3                          '                          ,                          '                          browserstack.debug                          '                          :                          true                          };                          commuter                          =                          wd                          .                          promiseRemote                          (                          "                          http://hub-deject.browserstack.com/wd/hub                          "                          );                          driver                          .                          init                          (                          desiredCaps                          )                          .                          and so                          (                          role                          ()                          {                          return                          commuter                          .                          get                          (                          '                          https://the-internet.herokuapp.com/upload                          '                          );                          })                          .                          then                          (                          function                          ()                          {                          let                          data                          =                          fs                          .                          readFileSync                          (                          '                          <local_file_path>                          '                          )                          let                          convertedData                          =                          new                          Buffer                          .                          from                          (                          data                          ,                          '                          base64                          '                          )                          return                          driver                          .                          pushFileToDevice                          (                          '                          /data/local/tmp/<file_name>                          '                          ,                          convertedData                          );                          })                          .                          so                          (                          office                          ()                          {                          render                          driver                          .                          elementById                          (                          "                          file-upload                          "                          );                          })                          .                          then                          (                          part                          (                          uploadFile                          )                          {                          render                          uploadFile                          .                          sendKeys                          (                          '                          /data/local/tmp/<file_name>                          '                          );                          })                          .                          and then                          (                          function                          ()                          {                          return                          driver                          .                          elementById                          (                          "                          file-submit                          "                          );                          })                          .                          then                          (                          office                          (                          clickSubmit                          )                          {                          return                          clickSubmit                          .                          click                          ();                          })                          .                          fin                          (                          function                          ()                          {                          return                          driver                          .                          quit                          ();                          })                          .                          done                          ();                                              
                                                  using                          Arrangement                          ;                          using                          OpenQA.Selenium.Appium                          ;                          using                          OpenQA.Selenium.Appium.Android                          ;                          using                          OpenQA.Selenium.Remote                          ;                          using                          OpenQA.Selenium.Back up.UI                          ;                          using                          Organization.Collections.Generic                          ;                          using                          OpenQA.Selenium                          ;                          using                          System.IO                          ;                          using                          NUnit.Framework                          ;                          namespace                          BrowserStack                          {                          public                          class                          UploadFile                          {                          [                          Test                          ]                          public                          void                          Test                          ()                          {                          AppiumOptions                          caps                          =                          new                          AppiumOptions                          ();                          // Set your BrowserStack access credentials                          caps                          .                          AddAdditionalCapability                          (                          "browserstack.user"                          ,                          "YOUR_USERNAME"                          );                          caps                          .                          AddAdditionalCapability                          (                          "browserstack.key"                          ,                          "YOUR_ACCESS_KEY"                          );                          // Specify device and os_version                          caps                          .                          AddAdditionalCapability                          (                          "device"                          ,                          "Samsung Galaxy S10"                          );                          caps                          .                          AddAdditionalCapability                          (                          "os_version"                          ,                          "nine.0"                          );                          caps                          .                          AddAdditionalCapability                          (                          "build"                          ,                          "Upload File - CSharp"                          );                          caps                          .                          AddAdditionalCapability                          (                          "name"                          ,                          "upload_file"                          );                          AndroidDriver                          <                          IWebElement                          >                          driver                          =                          new                          AndroidDriver                          <                          IWebElement                          >(                          new                          Uri                          (                          "http://hub-deject.browserstack.com/wd/hub"                          ),                          caps                          );                          commuter                          .                          PushFile                          (                          "/information/local/tmp/<file_name>"                          ,                          new                          FileInfo                          (                          "<local_file_path>"                          ));                          commuter                          .                          Navigate                          ().                          GoToUrl                          (                          "https://the-internet.herokuapp.com/upload"                          );                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "file-upload"                          )).                          SendKeys                          (                          "/information/local/tmp/<file_name>"                          );                          commuter                          .                          FindElement                          (                          By                          .                          Id                          (                          "file-submit"                          )).                          Submit                          ();                          driver                          .                          Quit                          ();                          }                          }                          }                                              
                                                  <?php                          require                          'android_upload.php'                          ;                          class                          AppAutomateTest                          extends                          BrowserStackTest                          {                          public                          function                          sendkeys                          (                          $elem                          ,                          $keys                          )                          {                          $data                          =                          array                          (                          'value'                          =>                          str_split                          (                          $keys                          ),                          'text'                          =>                          $keys                          );                          $url                          =                          $this                          ->                          getSessionUrl                          ()                          ->                          descend                          (                          'element'                          )                          ->                          descend                          (                          $elem                          ->                          getId                          ())                          ->                          descend                          (                          'value'                          );                          $this                          ->                          getDriver                          ()                          ->                          curl                          (                          'POST'                          ,                          $url                          ,                          $data                          );                          }                          public                          office                          testNativeApplication                          ()                          {                          $this                          ->                          pushFile                          (                          '/information/local/tmp/<file_name>'                          ,                          '<local_file_path>'                          );                          $this                          ->                          url                          (                          "https://the-cyberspace.herokuapp.com/upload"                          );                          $elem                          =                          $this                          ->                          byId                          (                          'file-upload'                          );                          $this                          ->                          sendkeys                          (                          $elem                          ,                          "/data/local/tmp/<file_name>"                          );                          $this                          ->                          chemical element                          (                          $this                          ->                          using                          (                          'id'                          )                          ->                          value                          (                          'file-submit'                          ))                          ->                          submit                          ();                          }                          }                          ?>                                              
                                                  from                          appium                          import                          webdriver                          from                          appium.webdriver.common.mobileby                          import                          MobileBy                          from                          selenium.webdriver.support.ui                          import                          WebDriverWait                          from                          selenium.webdriver.support                          import                          expected_conditions                          as                          EC                          import                          time                          userName                          =                          "YOUR_USERNAME"                          accessKey                          =                          "YOUR_ACCESS_KEY"                          desired_caps                          =                          {                          "os_version"                          :                          "8.0"                          ,                          "device"                          :                          "Samsung Galaxy S9"                          ,                          "proper noun"                          :                          "examination"                          ,                          "build"                          :                          "Python File Upload"                          }                          driver                          =                          webdriver                          .                          Remote                          (                          "https://"                          +                          userName                          +                          ":"                          +                          accessKey                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ,                          desired_caps                          )                          driver                          .                          push_file                          (                          "/data/local/tmp/<file_name>"                          ,                          source_path                          =                          "<local_file_path>"                          )                          driver                          .                          get                          (                          "https://the-cyberspace.herokuapp.com/upload"                          )                          driver                          .                          find_element_by_id                          (                          "file-upload"                          ).                          send_keys                          (                          "/data/local/tmp/<file_name>"                          )                          commuter                          .                          find_element_by_id                          (                          "file-submit"                          ).                          submit                          ();                          driver                          .                          quit                          ()                                              
                                                  require                          'rubygems'                          require                          'appium_lib'                          caps                          =                          {}                          caps                          [                          'device'                          ]                          =                          'Google Pixel 3'                          caps                          [                          'platformName'                          ]                          =                          'Android'                          caps                          [                          'realMobile'                          ]                          =                          'true'                          caps                          [                          'name'                          ]                          =                          'BStack-[Ruby] Sample Examination'                          # test proper name                          caps                          [                          'build'                          ]                          =                          'BStack Build Number one'                          # CI/CD job or build name                          appium_driver                          =                          Appium                          ::                          Commuter                          .                          new                          ({                          'caps'                          =>                          caps                          ,                          'appium_lib'                          =>                          {                          :server_url                          =>                          "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          }},                          true                          )                          driver                          =                          appium_driver                          .                          start_driver                          driver                          .                          push_file                          (                          '/information/local/tmp/<file_name>'                          ,                          (                          File                          .                          read                          '<local_file_path>'                          ))                          driver                          .                          go                          (                          "https://the-net.herokuapp.com/upload"                          )                          commuter                          .                          find_element                          (                          :id                          ,                          "file-upload"                          ).                          send_keys                          (                          "/data/local/tmp/<file_name>"                          )                          driver                          .                          find_element                          (                          :id                          ,                          "file-submit"                          ).                          submit                          ();                          driver                          .                          quit                                              

Note: Ensure to upload the file from your machine to BrowserStack remote machine's /data/local/tmp/<file_name> directory merely, and then upload file from BrowserStack remote machine'due south /data/local/tmp/<file_name> directory to the web application.

In the above code snippet, the pushFile() method is used to upload file from your machine to BrowserStack remote auto, the method accepts remote_machine_file_path and local_machine_file_path as arguments respectively. The code and then navigates to the URL where file has to exist uploaded and through the send_keys() method, upload the file which is present in remote_machine_file_path.

Uploading file in iOS device is possible by downloading that file outset and then uploading it in the aforementioned automate session. For more details, refer the section for uploading the files which are downloaded in the same Automate session.

Note: You tin upload any file format from your local system past just giving the path to that file.

Uploading pre-loaded files

Past default, desktop and mobile platforms accept some sample media files. This is also true for remote instances spun up on BrowserStack. Following are the file paths yous can use:

Windows 10, 8.1, viii, 7

                    In the below remote file paths there are two                      \,                      the first                      \                      is used every bit an escape character                      *Video*                      C:\\Users\\hi\\Documents\\video\\saper.avi C:\\Users\\howdy\\Documents\\video\\sample_mpeg4.mp4 C:\\Users\\hi\\Documents\\video\\sample_iTunes.mov C:\\Users\\hello\\Documents\\video\\sample_mpeg2.m2v                      *Images*                      C:\\Users\\hullo\\Documents\\images\\wallpaper1.jpg C:\\Users\\hello\\Documents\\images\\icon.png C:\\Users\\hi\\Documents\\images\\cartoon-animation.gif                      *Documents*                      C:\\Users\\howdy\\Documents\\documents\\xls-sample1.xls C:\\Users\\how-do-you-do\\Documents\\documents\\text-sample1.txt C:\\Users\\how-do-you-do\\Documents\\documents\\pdf-sample1.pdf C:\\Users\\hello\\Documents\\documents\\dr.-sample1.docx                      *Audio*                      C:\\Users\\hi\\Documents\\sound\\first_noel.mp3 C:\\Users\\howdy\\Documents\\audio\\BachCPE_SonataAmin_1.wma C:\\Users\\howdy\\Documents\\sound\\250Hz_44100Hz_16bit_05sec.wav                      *Zippo files*                      C:\\Users\\hello\\Documents\\4KBzipFile.zip C:\\Users\\hello\\Documents\\1MBzipFile.zip                                      

Windows XP

                    C:\\Documents\                      and\                      Settings\\hello\\url.txt                                      

You lot can cull whatsoever of the files from the higher up list for Windows operating systems, in the code snippet given below.

                                          *Video*                      /Users/test1/Documents/video/saper.avi /Users/test1/Documents/video/sample_mpeg4.mp4 /Users/test1/Documents/video/sample_iTunes.mov /Users/test1/Documents/video/sample_mpeg2.m2v                      *Images*                      /Users/test1/Documents/images/wallpaper1.jpg /Users/test1/Documents/images/icon.png /Users/test1/Documents/images/cartoon-blitheness.gif                      *Documents*                      /Users/test1/Documents/documents/xls-sample1.xls /Users/test1/Documents/documents/text-sample1.txt /Users/test1/Documents/documents/pdf-sample1.pdf /Users/test1/Documents/documents/doc-sample1.docx                      *Audio*                      /Users/test1/Documents/audio/first_noel.mp3 /Users/test1/Documents/audio/BachCPE_SonataAmin_1.wma /Users/test1/Documents/audio/250Hz_44100Hz_16bit_05sec.wav                      *Zip files*                      /Users/test1/Documents/4KBzipFile.zip /Users/test1/Documents/1MBzipFile.nada                                      

You tin cull any of the files from the above list for macOS operating systems, in the code snippet given below.

Uploading preloaded files in Android is non possible as of now, however you can upload the file from your machine to the spider web application using the pushFile() method as shown in Uploading files from your machine department

Uploading preloaded files in iOS can be implemented using the post-obit iOS snippets.

Yous can use those files to exam your web app'southward file upload functionality using Selenium's LocalFileDetector method and the file path.

                                                  import                          org.openqa.selenium.By                          ;                          import                          org.openqa.selenium.JavascriptExecutor                          ;                          import                          org.openqa.selenium.remote.DesiredCapabilities                          ;                          import                          org.openqa.selenium.remote.LocalFileDetector                          ;                          import                          org.openqa.selenium.remote.RemoteWebDriver                          ;                          import                          org.openqa.selenium.back up.ui.ExpectedConditions                          ;                          import                          org.openqa.selenium.back up.ui.WebDriverWait                          ;                          public                          grade                          JavaSample                          {                          public                          static                          concluding                          String                          AUTOMATE_USERNAME                          =                          "YOUR_USERNAME"                          ;                          public                          static                          terminal                          String                          AUTOMATE_KEY                          =                          "YOUR_ACCESS_KEY"                          ;                          public                          static                          final                          String                          URL                          =                          "https://"                          +                          AUTOMATE_USERNAME                          +                          ":"                          +                          AUTOMATE_KEY                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ;                          public                          static                          void                          main                          (                          Cord                          []                          args                          )                          throws                          Exception                          {                          DesiredCapabilities                          caps                          =                          new                          DesiredCapabilities                          ();                          caps                          .                          setCapability                          (                          "browser"                          ,                          "internet explorer"                          );                          caps                          .                          setCapability                          (                          "os"                          ,                          "windows"                          );                          caps                          .                          setCapability                          (                          "browser_version"                          ,                          "11.0"                          );                          caps                          .                          setCapability                          (                          "os_version"                          ,                          "10"                          );                          caps                          .                          setCapability                          (                          "browserstack.sendKeys"                          ,                          "true"                          );                          caps                          .                          setCapability                          (                          "browserstack.debug"                          ,                          "true"                          );                          caps                          .                          setCapability                          (                          "name"                          ,                          "Bstack-[Java] Sample Test"                          );                          RemoteWebDriver                          driver                          =                          new                          RemoteWebDriver                          (                          new                          URL                          (                          URL                          ),                          caps                          );                          driver                          .                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          driver                          .                          get                          (                          "http://www.fileconvoy.com/"                          );                          driver                          .                          findElement                          (                          By                          .                          id                          (                          "upfile_0"                          )).                          sendKeys                          (                          "C:\\Users\\hello\\Documents\\audio\\first_noel.mp3"                          );                          //File path in remote automobile                          driver                          .                          findElement                          (                          By                          .                          id                          (                          "readTermsOfUse"                          )).                          click                          ();                          driver                          .                          findElement                          (                          By                          .                          name                          (                          "upload_button"                          )).                          submit                          ();                          JavascriptExecutor                          jse                          =                          (                          JavascriptExecutor                          )                          commuter                          ;                          endeavor                          {                          WebDriverWait                          await                          =                          new                          WebDriverWait                          (                          driver                          ,                          5                          );                          wait                          .                          until                          (                          ExpectedConditions                          .                          presenceOfElementLocated                          (                          By                          .                          id                          (                          "TopMessage"                          )));                          if                          (                          driver                          .                          findElementById                          (                          "TopMessage"                          ).                          getText                          ().                          contains                          (                          "successfully uploaded"                          ))                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"passed\", \"reason\": \"File uploaded successfully\"}}"                          );                          }                          else                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"activeness\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File upload failed\"}}"                          );                          }                          }                          take hold of                          (                          Exception                          e                          )                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File could not be uploaded in five seconds\"}}"                          );                          }                          commuter                          .                          quit                          ();                          }                          }                                              
                                                  const                          webdriver                          =                          require                          (                          "                          selenium-webdriver                          "                          );                          const                          remote                          =                          require                          (                          "                          selenium-webdriver/remote                          "                          );                          // Input capabilities                          const                          capabilities                          =                          {                          "                          browserName                          "                          :                          "                          Internet Explorer                          "                          ,                          "                          browser_version                          "                          :                          "                          11.0                          "                          ,                          "                          os                          "                          :                          "                          Windows                          "                          ,                          "                          os_version                          "                          :                          "                          10                          "                          ,                          "                          name                          "                          :                          "                          Bstack-[NodeJS] Upload Test                          "                          ,                          "                          browserstack.sendKeys                          "                          :                          "                          true                          "                          ,                          "                          browserstack.debug                          "                          :                          "                          true                          "                          ,                          "                          browserstack.user                          "                          :                          "                          YOUR_USERNAME                          "                          ,                          "                          browserstack.fundamental                          "                          :                          "                          YOUR_ACCESS_KEY                          "                          };                          const                          driver                          =                          new                          webdriver                          .                          Builder                          ()                          .                          usingServer                          (                          "                          https://hub-cloud.browserstack.com/wd/hub                          "                          )                          .                          withCapabilities                          (                          capabilities                          )                          .                          build                          ();                          //This volition observe your local file                          commuter                          .                          setFileDetector                          (                          new                          remote                          .                          FileDetector                          ());                          (                          async                          ()                          =>                          {                          look                          commuter                          .                          get                          (                          "                          http://www.fileconvoy.com                          "                          );                          const                          filePathElement                          =                          await                          commuter                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          "                          upfile_0                          "                          ));                          look                          filePathElement                          .                          sendKeys                          (                          "                          C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          audio                          \\                          first_noel.mp3                          "                          );                          look                          (                          wait                          driver                          .                          findElement                          (                          webdriver                          .                          Past                          .                          id                          (                          "                          readTermsOfUse                          "                          ))).                          click                          ();                          expect                          (                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          proper noun                          (                          "                          upload_button                          "                          ))).                          click                          ();                          try                          {                          await                          driver                          .                          wait                          (                          webdriver                          .                          until                          .                          elementIsVisible                          ((                          await                          driver                          .                          findElement                          (                          webdriver                          .                          Past                          .                          id                          (                          '                          TopMessage                          '                          )))),                          5000                          );                          if                          ((                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )).                          getText                          ()).                          includes                          (                          '                          successfully uploaded                          '                          ))                          {                          expect                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"activeness": "setSessionStatus", "arguments": {"condition":"passed","reason": "File upload successful"}}                          '                          );                          }                          else                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "File upload failed"}}                          '                          );                          }                          }                          catch                          (                          eastward                          )                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"failed","reason": "File could not be uploaded in fourth dimension"}}                          '                          );                          }                          expect                          commuter                          .                          quit                          ();                          })();                                              
                                                  using                          System                          ;                          using                          OpenQA.Selenium                          ;                          using                          OpenQA.Selenium.Remote                          ;                          namespace                          SeleniumTest                          {                          grade                          Program                          {                          static                          void                          Main                          (                          string                          []                          args                          )                          {                          IWebDriver                          driver                          ;                          OpenQA                          .                          Selenium                          .                          IE                          .                          InternetExplorerOptions                          capability                          =                          new                          OpenQA                          .                          Selenium                          .                          IE                          .                          InternetExplorerOptions                          ();                          capability                          .                          AddAdditionalCapability                          (                          "browser"                          ,                          "IE"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browser_version"                          ,                          "11"                          ,                          truthful                          );                          capability                          .                          AddAdditionalCapability                          (                          "os"                          ,                          "Windows"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "os_version"                          ,                          "10"                          ,                          true                          );                          adequacy                          .                          AddAdditionalCapability                          (                          "browserstack.sendKeys"                          ,                          "true"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.debug"                          ,                          "true"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.user"                          ,                          "YOUR_USERNAME"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.key"                          ,                          "YOUR_ACCESS_KEY"                          ,                          truthful                          );                          adequacy                          .                          AddAdditionalCapability                          (                          "name"                          ,                          "Bstack-[C_sharp] Sample Test"                          ,                          true                          );                          driver                          =                          new                          RemoteWebDriver                          (                          new                          Uri                          (                          "http://hub-cloud.browserstack.com/wd/hub/"                          ),                          adequacy                          );                          driver                          .                          Navigate                          ().                          GoToUrl                          (                          "http://www.fileconvoy.com"                          );                          IWebElement                          uploadFile                          =                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upfile_0"                          ));                          Console                          .                          WriteLine                          (                          commuter                          .                          Championship                          );                          Cord                          path                          =                          "C:\\Users\\hello\\Documents\\sound\\first_noel.mp3"                          ;                          //File path in remote machine                          LocalFileDetector                          detector                          =                          new                          LocalFileDetector                          ();                          var                          allowsDetection                          =                          commuter                          every bit                          IAllowsFileDetection                          ;                          if                          (                          allowsDetection                          !=                          null                          )                          {                          allowsDetection                          .                          FileDetector                          =                          new                          LocalFileDetector                          ();                          }                          uploadFile                          .                          SendKeys                          (                          path                          );                          commuter                          .                          FindElement                          (                          By                          .                          Id                          (                          "readTermsOfUse"                          )).                          Click                          ();                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upload_button"                          )).                          Click                          ();                          driver                          .                          Manage                          ().                          Timeouts                          ().                          ImplicitWait                          =                          TimeSpan                          .                          FromSeconds                          (                          five                          );                          if                          (                          driver                          .                          FindElement                          (                          By                          .                          CssSelector                          (                          "#TopMessage"                          )).                          Text                          .                          Contains                          (                          "successfully uploaded"                          ))                          {                          ((                          IJavaScriptExecutor                          )                          commuter                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"activity\": \"setSessionStatus\", \"arguments\": {\"condition\":\"passed\", \"reason\": \"File uploaded successfully!\"}}"                          );                          }                          else                          {                          ((                          IJavaScriptExecutor                          )                          driver                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \"File upload failed!\"}}"                          );                          }                          driver                          .                          Quit                          ();                          }                          }                          }                                              
                                                  <?php                          require_once                          (                          'vendor/autoload.php'                          );                          use                          Facebook\WebDriver\Remote\RemoteWebDriver                          ;                          use                          Facebook\WebDriver\WebDriverBy                          ;                          use                          Facebook\WebDriver\Remote\LocalFileDetector                          ;                          $caps                          =                          assortment                          (                          "browser"                          =>                          "Cyberspace Explorer"                          ,                          "browser_version"                          =>                          "xi.0"                          ,                          "os"                          =>                          "Windows"                          ,                          "os_version"                          =>                          "x"                          ,                          "browserstack.sendKeys"                          =>                          "true"                          ,                          "name"                          =>                          "Bstack-[Php] Sample Test"                          ,                          "browserstack.debug"                          =>                          "true"                          );                          $web_driver                          =                          RemoteWebDriver                          ::                          create                          (                          "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          $caps                          );                          $web_driver                          ->                          get                          (                          "http://www.fileconvoy.com"                          );                          $file_input                          =                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "upfile_0"                          ));                          $file_input                          ->                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          $file_input                          ->                          sendKeys                          (                          "C:                          \\                          Users                          \\                          howdy                          \\                          Documents                          \\                          audio                          \\                          first_noel.mp3"                          );                          //File path in remote motorcar                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "readTermsOfUse"                          ))                          ->                          click                          ();                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          proper noun                          (                          "upload_button"                          ))                          ->                          submit                          ();                          sleep                          (                          v                          );                          $web_driver                          ->                          quit                          ();                          ?>                                              
                                                  from                          selenium                          import                          webdriver                          from                          selenium.webdriver.mutual.keys                          import                          Keys                          from                          selenium.webdriver.common.desired_capabilities                          import                          DesiredCapabilities                          from                          selenium.mutual.exceptions                          import                          TimeoutException                          from                          selenium.webdriver.support.ui                          import                          WebDriverWait                          desired_cap                          =                          {                          'browser'                          :                          'Internet Explorer'                          ,                          'browser_version'                          :                          'eleven.0'                          ,                          'bone'                          :                          'Windows'                          ,                          'os_version'                          :                          '10'                          ,                          'browserstack.sendKeys'                          :                          'true'                          ,                          'browserstack.debug'                          :                          'truthful'                          ,                          'name'                          :                          'Bstack-[Python] Sample Test'                          }                          driver                          =                          webdriver                          .                          Remote                          (                          command_executor                          =                          'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.browserstack.com/wd/hub'                          ,                          desired_capabilities                          =                          desired_cap                          )                          driver                          .                          get                          (                          'http://world wide web.fileconvoy.com'                          )                          driver                          .                          find_element_by_id                          (                          'upfile_0'                          ).                          send_keys                          (                          'C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          audio                          \\                          first_noel.mp3'                          )                          #File path in remote auto                                                    commuter                          .                          find_element_by_id                          (                          'readTermsOfUse'                          ).                          click                          ()                          driver                          .                          find_element_by_name                          (                          'upload_button'                          ).                          submit                          ()                          endeavor                          :                          WebDriverWait                          (                          driver                          ,                          5                          ).                          until                          (                          lambda                          x                          :                          x                          .                          find_element_by_id                          (                          'TopMessage'                          ))                          if                          (                          driver                          .                          find_element_by_id                          (                          'TopMessage'                          ).                          text                          ==                          "Your file(s) have been successfully uploaded."                          ):                          # Setting the status of exam equally 'passed' or 'failed' based on the condition; if title of the spider web page starts with 'BrowserStack'                                                    commuter                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed", "reason": "File uploaded!"}}'                          )                          else                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "File upload failed"}}'                          )                          except                          TimeoutException                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"failed", "reason": "File failed to upload in v seconds"}}'                          )                          driver                          .                          quit                          ()                                              
                                                  require                          'rubygems'                          require                          'selenium-webdriver'                          # Input capabilities                          caps                          =                          Selenium                          ::                          WebDriver                          ::                          Remote                          ::                          Capabilities                          .                          new                          caps                          [                          'browser'                          ]                          =                          'Cyberspace Explorer'                          caps                          [                          'browser_version'                          ]                          =                          '11.0'                          caps                          [                          'os'                          ]                          =                          'Windows'                          caps                          [                          'os_version'                          ]                          =                          '10'                          caps                          [                          'proper name'                          ]                          =                          'Bstack-[Crimson] Sample Test'                          caps                          [                          'browserstack.sendKeys'                          ]                          =                          'true'                          caps                          [                          'browserstack.debug'                          ]                          =                          'true'                          caps                          [                          "javascriptEnabled"                          ]                          =                          'truthful'                          #Enabling the javascriptEnabled capability to execute javascript in the test script                          driver                          =                          Selenium                          ::                          WebDriver                          .                          for                          (                          :remote                          ,                          :url                          =>                          "http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          :desired_capabilities                          =>                          caps                          )                          commuter                          .                          file_detector                          =                          lambda                          do                          |                          args                          |                          str                          =                          args                          .                          get-go                          .                          to_s                          str                          if                          File                          .                          exist?                          (                          str                          )                          cease                          commuter                          .                          navigate                          .                          to                          "http://www.fileconvoy.com"                          driver                          .                          find_element                          (                          :id                          ,                          "upfile_0"                          ).                          send_keys                          (                          "C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          sound                          \\                          first_noel.mp3"                          )                          #File path in remote automobile                          driver                          .                          execute_script                          (                          'document.getElementById("readTermsOfUse").click();'                          )                          driver                          .                          find_element                          (                          :proper name                          ,                          "upload_button"                          ).                          submit                          sleep                          (                          v                          )                          driver                          .                          quit                                              
                                                  utilise                          Selenium::Remote::                          Commuter                          ;                          #Input capabilities                          my                          $extraCaps                          =                          {                          "                          browser                          "                          =>                          "                          Net Explorer                          ",                          "                          browser_version                          "                          =>                          "                          eleven.0                          ",                          "                          os                          "                          =>                          "                          Windows                          ",                          "                          os_version                          "                          =>                          "                          10                          ",                          "                          browserstack.sendKeys                          "                          =>                          "                          true                          ",                          "                          browserstack.debug                          "                          =>                          "                          true                          ",                          "                          proper name                          "                          =>                          "                          Bstack-[Perl] Sample Test                          "                          };                          my                          $login                          =                          "                          YOUR_USERNAME                          ";                          my                          $key                          =                          "                          YOUR_ACCESS_KEY                          ";                          my                          $host                          =                          "                          $login                          :                          $central                          \@                          hub-cloud.browserstack.com                          ";                          my                          $commuter                          =                          new                          Selenium::Remote::                          Commuter                          ('                          remote_server_addr                          '                          =>                          $host                          ,                          '                          port                          '                          =>                          '                          fourscore                          ',                          '                          extra_capabilities                          '                          =>                          $extraCaps                          );                          my                          $remote_fname                          =                          $driver                          ->                          upload_file                          ("                          C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          audio                          \\                          first_noel.mp3                          ");                          #File path in remote car                          $driver                          ->                          go                          ('                          http://www.fileconvoy.com                          ');                          $driver                          ->                          find_element                          ('                          upfile_0                          ','                          id                          ')                          ->                          send_keys                          (                          $remote_fname                          );                          $driver                          ->                          find_element                          ('                          readTermsOfUse                          ',                          '                          id                          ')                          ->                          click                          ();                          $driver                          ->                          find_element                          ('                          upload_button                          ',                          '                          proper name                          ')                          ->                          submit                          ();                          slumber                          40                          ;                          $driver                          ->                          quit                          ();                                              

Notation: Other browsers include Chrome, Firefox, Edge and Safari browsers.

You can use those files to test your web app's file upload functionality using Selenium's LocalFileDetector method and the file path.

                                                  import                          org.openqa.selenium.Past                          ;                          import                          org.openqa.selenium.JavascriptExecutor                          ;                          import                          org.openqa.selenium.remote.DesiredCapabilities                          ;                          import                          org.openqa.selenium.remote.LocalFileDetector                          ;                          import                          org.openqa.selenium.remote.RemoteWebDriver                          ;                          import                          org.openqa.selenium.back up.ui.ExpectedConditions                          ;                          import                          org.openqa.selenium.back up.ui.WebDriverWait                          ;                          import                          java.net.URL                          ;                          public                          form                          JavaSample                          {                          public                          static                          final                          Cord                          AUTOMATE_USERNAME                          =                          "YOUR_USERNAME"                          ;                          public                          static                          final                          String                          AUTOMATE_KEY                          =                          "YOUR_ACCESS_KEY"                          ;                          public                          static                          final                          String                          URL                          =                          "https://"                          +                          AUTOMATE_USERNAME                          +                          ":"                          +                          AUTOMATE_KEY                          +                          "@hub-cloud.browserstack.com/wd/hub"                          ;                          public                          static                          void                          main                          (                          String                          []                          args                          )                          throws                          Exception                          {                          DesiredCapabilities                          caps                          =                          new                          DesiredCapabilities                          ();                          caps                          .                          setCapability                          (                          "browser"                          ,                          "chrome"                          );                          caps                          .                          setCapability                          (                          "os"                          ,                          "windows"                          );                          caps                          .                          setCapability                          (                          "browser_version"                          ,                          "latest"                          );                          caps                          .                          setCapability                          (                          "os_version"                          ,                          "10"                          );                          caps                          .                          setCapability                          (                          "name"                          ,                          "Bstack-[Coffee] Sample Test"                          );                          RemoteWebDriver                          driver                          =                          new                          RemoteWebDriver                          (                          new                          URL                          (                          URL                          ),                          caps                          );                          commuter                          .                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          driver                          .                          get                          (                          "http://www.fileconvoy.com/"                          );                          driver                          .                          findElement                          (                          Past                          .                          id                          (                          "upfile_0"                          )).                          sendKeys                          (                          "C:\\Users\\hullo\\Documents\\images\\wallpaper1.jpg"                          );                          //File path in remote motorcar                          commuter                          .                          findElement                          (                          By                          .                          id                          (                          "readTermsOfUse"                          )).                          click                          ();                          commuter                          .                          findElement                          (                          By                          .                          name                          (                          "upload_button"                          )).                          submit                          ();                          JavascriptExecutor                          jse                          =                          (                          JavascriptExecutor                          )                          driver                          ;                          try                          {                          WebDriverWait                          wait                          =                          new                          WebDriverWait                          (                          driver                          ,                          five                          );                          await                          .                          until                          (                          ExpectedConditions                          .                          presenceOfElementLocated                          (                          By                          .                          id                          (                          "TopMessage"                          )));                          if                          (                          driver                          .                          findElementById                          (                          "TopMessage"                          ).                          getText                          ().                          contains                          (                          "successfully uploaded"                          ))                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"passed\", \"reason\": \"File uploaded successfully\"}}"                          );                          }                          else                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File upload failed\"}}"                          );                          }                          }                          catch                          (                          Exception                          e                          )                          {                          jse                          .                          executeScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"failed\", \"reason\": \"File could not be uploaded in 5 seconds\"}}"                          );                          }                          commuter                          .                          quit                          ();                          }                          }                                              
                                                  const                          webdriver                          =                          crave                          (                          '                          selenium-webdriver                          '                          );                          const                          fs                          =                          require                          (                          '                          fs                          '                          );                          const                          remote                          =                          require                          (                          '                          selenium-webdriver/remote                          '                          );                          // Input capabilities                          const                          capabilities                          =                          {                          '                          browserName                          '                          :                          '                          safari                          '                          ,                          '                          browser_version                          '                          :                          '                          latest                          '                          ,                          '                          os                          '                          :                          '                          Bone X                          '                          ,                          '                          os_version                          '                          :                          '                          Big Sur                          '                          ,                          '                          proper name                          '                          :                          '                          Safari test file upload                          '                          ,                          // test proper name                          '                          build                          '                          :                          '                          File upload testing                          '                          // Build name                          }                          async                          function                          runTestWithCaps                          ()                          {                          let                          driver                          =                          new                          webdriver                          .                          Builder                          ()                          .                          usingServer                          (                          '                          http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub                          '                          )                          .                          withCapabilities                          (                          capabilities                          )                          .                          build                          ();                          //This will detect your local file                          await                          commuter                          .                          setFileDetector                          (                          new                          remote                          .                          FileDetector                          );                          await                          commuter                          .                          get                          (                          '                          http://www.fileconvoy.com/                          '                          );                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          upfile_0                          '                          )).                          sendKeys                          (                          '                          /Users/test1/Documents/video/saper.avi                          '                          );                          // The file path in remote Mac machine is given here. See the sample file paths for unlike remote machines in the documentation page                          wait                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          readTermsOfUse                          '                          )).                          click                          ();                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          upload_button                          '                          )).                          click                          ();                          await                          driver                          .                          await                          (                          webdriver                          .                          until                          .                          elementLocated                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )),                          5000                          );                          if                          ((                          await                          driver                          .                          findElement                          (                          webdriver                          .                          By                          .                          id                          (                          '                          TopMessage                          '                          )).                          getText                          ()).                          includes                          (                          '                          successfully uploaded                          '                          ))                          {                          await                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"activeness": "setSessionStatus", "arguments": {"status":"passed","reason": "File upload successful"}}                          '                          );                          }                          else                          {                          expect                          driver                          .                          executeScript                          (                          '                          browserstack_executor: {"action": "setSessionStatus", "arguments": {"condition":"failed","reason": "File upload failed"}}                          '                          );                          }                          await                          driver                          .                          quit                          ();                          }                          runTestWithCaps                          ();                                              
                                                  using                          System                          ;                          using                          OpenQA.Selenium                          ;                          using                          OpenQA.Selenium.Remote                          ;                          namespace                          SeleniumTest                          {                          class                          Program                          {                          static                          void                          Main                          (                          string                          []                          args                          )                          {                          IWebDriver                          driver                          ;                          OpenQA                          .                          Selenium                          .                          Chrome                          .                          ChromeOptions                          capability                          =                          new                          OpenQA                          .                          Selenium                          .                          Chrome                          .                          ChromeOptions                          ();                          capability                          .                          AddAdditionalCapability                          (                          "browser"                          ,                          "Chrome"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browser_version"                          ,                          "latest"                          ,                          true                          );                          adequacy                          .                          AddAdditionalCapability                          (                          "bone"                          ,                          "Windows"                          ,                          true                          );                          adequacy                          .                          AddAdditionalCapability                          (                          "os_version"                          ,                          "10"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.user"                          ,                          "YOUR_USERNAME"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "browserstack.fundamental"                          ,                          "YOUR_ACCESS_KEY"                          ,                          true                          );                          capability                          .                          AddAdditionalCapability                          (                          "name"                          ,                          "Bstack-[C_sharp] Sample Test"                          ,                          true                          );                          driver                          =                          new                          RemoteWebDriver                          (                          new                          Uri                          (                          "http://hub-cloud.browserstack.com/wd/hub/"                          ),                          adequacy                          );                          commuter                          .                          Navigate                          ().                          GoToUrl                          (                          "http://world wide web.fileconvoy.com"                          );                          IWebElement                          uploadFile                          =                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upfile_0"                          ));                          Console                          .                          WriteLine                          (                          driver                          .                          Title                          );                          String                          path                          =                          "C:\\Users\\hello\\Documents\\images\\wallpaper1.jpg"                          ;                          //File path in remote machine                          uploadFile                          .                          SendKeys                          (                          path                          );                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "readTermsOfUse"                          )).                          Click                          ();                          driver                          .                          FindElement                          (                          By                          .                          Id                          (                          "upload_button"                          )).                          Click                          ();                          commuter                          .                          Manage                          ().                          Timeouts                          ().                          ImplicitWait                          =                          TimeSpan                          .                          FromSeconds                          (                          five                          );                          String                          upshot                          =                          driver                          .                          FindElement                          (                          By                          .                          CssSelector                          (                          "#TopMessage"                          )).                          Text                          ;                          if                          (                          result                          .                          Contains                          (                          "successfully uploaded"                          ))                          {                          ((                          IJavaScriptExecutor                          )                          commuter                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"activeness\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \"File uploaded successfully!\"}}"                          );                          }                          else                          {                          ((                          IJavaScriptExecutor                          )                          commuter                          ).                          ExecuteScript                          (                          "browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \"File upload failed!\"}}"                          );                          }                          driver                          .                          Quit                          ();                          }                          }                          }                                              
                                                  <?php                          require_once                          (                          'vendor/autoload.php'                          );                          use                          Facebook\WebDriver\Remote\RemoteWebDriver                          ;                          use                          Facebook\WebDriver\WebDriverBy                          ;                          apply                          Facebook\WebDriver\Remote\LocalFileDetector                          ;                          $caps                          =                          assortment                          (                          "browser"                          =>                          "Chrome"                          ,                          "browser_version"                          =>                          "75.0"                          ,                          "os"                          =>                          "Windows"                          ,                          "os_version"                          =>                          "10"                          ,                          "name"                          =>                          "Bstack-[Php] Sample Test"                          );                          $web_driver                          =                          RemoteWebDriver                          ::                          create                          (                          "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          $caps                          );                          $web_driver                          ->                          get                          (                          "http://www.fileconvoy.com"                          );                          $file_input                          =                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "upfile_0"                          ));                          $file_input                          ->                          setFileDetector                          (                          new                          LocalFileDetector                          ());                          $file_input                          ->                          sendKeys                          (                          "C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          images                          \\                          wallpaper1.jpg"                          );                          //File path in remote machine                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          id                          (                          "readTermsOfUse"                          ))                          ->                          click                          ();                          $web_driver                          ->                          findElement                          (                          WebDriverBy                          ::                          name                          (                          "upload_button"                          ))                          ->                          submit                          ();                          sleep                          (                          5                          );                          $web_driver                          ->                          quit                          ();                          ?>                                              
                                                  from                          selenium                          import                          webdriver                          from                          selenium.webdriver.mutual.keys                          import                          Keys                          from                          selenium.webdriver.common.desired_capabilities                          import                          DesiredCapabilities                          from                          selenium.common.exceptions                          import                          TimeoutException                          from                          selenium.webdriver.support.ui                          import                          WebDriverWait                          desired_cap                          =                          {                          'browser'                          :                          'Chrome'                          ,                          'browser_version'                          :                          '75.0'                          ,                          'os'                          :                          'Windows'                          ,                          'os_version'                          :                          'x'                          ,                          'name'                          :                          'Bstack-[Python] Sample Examination'                          }                          commuter                          =                          webdriver                          .                          Remote                          (                          command_executor                          =                          'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.browserstack.com/wd/hub'                          ,                          desired_capabilities                          =                          desired_cap                          )                          commuter                          .                          get                          (                          'http://www.fileconvoy.com'                          )                          commuter                          .                          find_element_by_id                          (                          'upfile_0'                          ).                          send_keys                          (                          'C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          images                          \\                          wallpaper1.jpg'                          )                          #File path in remote machine                                                    driver                          .                          find_element_by_id                          (                          'readTermsOfUse'                          ).                          click                          ()                          commuter                          .                          find_element_by_name                          (                          'upload_button'                          ).                          submit                          ()                          endeavor                          :                          WebDriverWait                          (                          driver                          ,                          5                          ).                          until                          (                          lambda                          x                          :                          x                          .                          find_element_by_id                          (                          'TopMessage'                          ))                          if                          (                          driver                          .                          find_element_by_id                          (                          'TopMessage'                          ).                          text                          ==                          "Your file(southward) have been successfully uploaded."                          ):                          # Setting the status of test every bit 'passed' or 'failed' based on the condition; if title of the web page starts with 'BrowserStack'                                                    driver                          .                          execute_script                          (                          'browserstack_executor: {"activeness": "setSessionStatus", "arguments": {"status":"passed", "reason": "File uploaded!"}}'                          )                          else                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "File upload failed"}}'                          )                          except                          TimeoutException                          :                          driver                          .                          execute_script                          (                          'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "File failed to upload in 5 seconds"}}'                          )                          driver                          .                          quit                          ()                                              
                                                  crave                          'rubygems'                          require                          'selenium-webdriver'                          # Input capabilities                          caps                          =                          Selenium                          ::                          WebDriver                          ::                          Remote                          ::                          Capabilities                          .                          new                          caps                          [                          'browser'                          ]                          =                          'Chrome'                          caps                          [                          'browser_version'                          ]                          =                          '75.0'                          caps                          [                          'os'                          ]                          =                          'Windows'                          caps                          [                          'os_version'                          ]                          =                          '10'                          caps                          [                          'proper noun'                          ]                          =                          'Bstack-[Scarlet] Sample Test'                          driver                          =                          Selenium                          ::                          WebDriver                          .                          for                          (                          :remote                          ,                          :url                          =>                          "http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                          ,                          :desired_capabilities                          =>                          caps                          )                          driver                          .                          file_detector                          =                          lambda                          do                          |                          args                          |                          str                          =                          args                          .                          first                          .                          to_s                          str                          if                          File                          .                          exist?                          (                          str                          )                          end                          driver                          .                          navigate                          .                          to                          "http://www.fileconvoy.com"                          commuter                          .                          find_element                          (                          :id                          ,                          "upfile_0"                          ).                          send_keys                          (                          "C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          images                          \\                          wallpaper1.jpg"                          );                          #File path in remote machine                          driver                          .                          find_element                          (                          :id                          ,                          "readTermsOfUse"                          ).                          click                          ;                          driver                          .                          find_element                          (                          :name                          ,                          "upload_button"                          ).                          submit                          ;                          sleep                          (                          5                          )                          driver                          .                          quit                                              
                                                  use                          Selenium::Remote::                          Commuter                          ;                          #Input capabilities                          my                          $extraCaps                          =                          {                          "                          browser                          "                          =>                          "                          Chrome                          ",                          "                          browser_version                          "                          =>                          "                          75.0                          ",                          "                          os                          "                          =>                          "                          Windows                          ",                          "                          os_version                          "                          =>                          "                          10                          ",                          "                          name                          "                          =>                          "                          Bstack-[Perl] Sample Test                          "                          };                          my                          $login                          =                          "                          YOUR_USERNAME                          ";                          my                          $key                          =                          "                          YOUR_ACCESS_KEY                          ";                          my                          $host                          =                          "                          $login                          :                          $key                          \@                          hub-deject.browserstack.com                          ";                          my                          $driver                          =                          new                          Selenium::Remote::                          Driver                          ('                          remote_server_addr                          '                          =>                          $host                          ,                          '                          port                          '                          =>                          '                          80                          ',                          '                          extra_capabilities                          '                          =>                          $extraCaps                          );                          my                          $remote_fname                          =                          $driver                          ->                          upload_file                          ("                          C:                          \\                          Users                          \\                          hello                          \\                          Documents                          \\                          images                          \\                          wallpaper1.jpg                          ");                          #File path in remote machine                          $driver                          ->                          get                          ('                          http://www.fileconvoy.com                          ');                          $driver                          ->                          find_element                          ('                          upfile_0                          ','                          id                          ')                          ->                          send_keys                          (                          $remote_fname                          );                          $driver                          ->                          find_element                          ('                          readTermsOfUse                          ',                          '                          id                          ')                          ->                          click                          ();                          $driver                          ->                          find_element                          ('                          upload_button                          ',                          '                          proper noun                          ')                          ->                          submit                          ();                          sleep                          forty                          ;                          $driver                          ->                          quit                          ();                                              
                                              import                        coffee.internet.URL                        ;                        import                        java.util.List                        ;                        import                        java.util.Gear up                        ;                        import                        java.net.MalformedURLException                        ;                        import                        org.openqa.selenium.support.ui.WebDriverWait                        ;                        import                        org.openqa.selenium.Past                        ;                        import                        org.openqa.selenium.WebElement                        ;                        import                        org.openqa.selenium.remote.DesiredCapabilities                        ;                        import                        org.openqa.selenium.remote.RemoteWebElement                        ;                        import                        org.openqa.selenium.back up.ui.ExpectedConditions                        ;                        import                        io.appium.java_client.MobileBy                        ;                        import                        io.appium.java_client.ios.IOSDriver                        ;                        import                        io.appium.java_client.ios.IOSElement                        ;                        import                        org.apache.commons.lang3.*                        ;                        public                        class                        Upload                        extends                        Thread                        {                        public                        static                        String                        userName                        =                        "YOUR_USERNAME"                        ;                        public                        static                        String                        accessKey                        =                        "YOUR_ACCESS_KEY"                        ;                        public                        static                        void                        main                        (                        Cord                        args                        [])                        throws                        MalformedURLException                        ,                        InterruptedException                        {                        DesiredCapabilities                        caps                        =                        new                        DesiredCapabilities                        ();                        caps                        .                        setCapability                        (                        "device"                        ,                        "iPhone 12 Pro Max"                        );                        caps                        .                        setCapability                        (                        "os_version"                        ,                        "fourteen"                        );                        caps                        .                        setCapability                        (                        "real_mobile"                        ,                        "true"                        );                        caps                        .                        setCapability                        (                        "project"                        ,                        "My Get-go Project"                        );                        caps                        .                        setCapability                        (                        "build"                        ,                        "My First Build"                        );                        caps                        .                        setCapability                        (                        "name"                        ,                        "Bstack-[Coffee] Sample Test"                        );                        caps                        .                        setCapability                        (                        "nativeWebTap"                        ,                        "true"                        );                        IOSDriver                        <                        IOSElement                        >                        commuter                        =                        new                        IOSDriver                        <                        IOSElement                        >(                        new                        URL                        (                        "https://"                        +                        userName                        +                        ":"                        +                        accessKey                        +                        "@hub-cloud.browserstack.com/wd/hub"                        ),                        caps                        );                        commuter                        .                        get                        (                        "https://the-internet.herokuapp.com/upload"                        );                        Thread                        .                        sleep                        (                        5000                        );                        commuter                        .                        findElement                        (                        Past                        .                        id                        (                        "file-upload"                        )).                        click                        ();                        driver                        .                        context                        (                        "NATIVE_APP"                        );                        driver                        .                        findElement                        (                        By                        .                        proper name                        (                        "Photograph Library"                        )).                        click                        ();                        Thread                        .                        sleep                        (                        5000                        );                        List                        list                        =                        driver                        .                        findElements                        (                        By                        .                        className                        (                        "XCUIElementTypeImage"                        ));                        ((                        IOSElement                        )                        list                        .                        go                        (                        0                        )).                        click                        ();                        Thread                        .                        sleep                        (                        5000                        );                        driver                        .                        findElement                        (                        By                        .                        name                        (                        "Cull"                        )).                        click                        ();                        Set                        <                        Cord                        >                        contextName                        =                        driver                        .                        getContextHandles                        ();                        driver                        .                        context                        (                        contextName                        .                        toArray                        ()[                        1                        ].                        toString                        ());                        commuter                        .                        findElement                        (                        By                        .                        id                        (                        "file-submit"                        )).                        click                        ();                        driver                        .                        quit                        ();                        }                        }                                          
                                              var                        wd                        =                        require                        (                        '                        wd                        '                        );                        // Input capabilities                        const                        capabilities                        =                        {                        '                        device                        '                        :                        '                        iPhone 12                        '                        ,                        '                        realMobile                        '                        :                        '                        true                        '                        ,                        '                        os_version                        '                        :                        '                        14.0                        '                        ,                        '                        browserName                        '                        :                        '                        iPhone                        '                        ,                        '                        proper noun                        '                        :                        '                        BStack-[NodeJS] Sample Examination                        '                        ,                        '                        build                        '                        :                        '                        BStack Build Number 1                        '                        ,                        "                        nativeWebTap                        "                        :                        true                        }                        async                        function                        runTestWithCaps                        ()                        {                        allow                        driver                        =                        wd                        .                        promiseRemote                        (                        "                        http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub                        "                        );                        look                        driver                        .                        init                        (                        capabilities                        );                        await                        driver                        .                        get                        (                        "                        https://the-internet.herokuapp.com/upload                        "                        )                        wait                        new                        Promise                        (                        r                        =>                        setTimeout                        (                        r                        ,                        2000                        ));                        chemical element                        =                        await                        driver                        .                        waitForElementById                        (                        '                        file-upload                        '                        )                        wait                        element                        .                        click                        ()                        await                        driver                        .                        context                        (                        '                        NATIVE_APP                        '                        )                        element                        =                        expect                        driver                        .                        waitForElementByName                        (                        '                        Photo Library                        '                        )                        await                        element                        .                        click                        ()                        look                        new                        Promise                        (                        r                        =>                        setTimeout                        (                        r                        ,                        2000                        ));                        element                        =                        await                        driver                        .                        elementsByClassName                        (                        '                        XCUIElementTypeImage                        '                        )                        await                        element                        [                        0                        ].                        click                        ()                        await                        new                        Promise                        (                        r                        =>                        setTimeout                        (                        r                        ,                        5000                        ));                        element                        =                        await                        driver                        .                        waitForElementByName                        (                        '                        Choose                        '                        )                        await                        chemical element                        .                        click                        ()                        look                        new                        Hope                        (                        r                        =>                        setTimeout                        (                        r                        ,                        10000                        ));                        contexts                        =                        await                        driver                        .                        contexts                        ();                        await                        driver                        .                        context                        (                        contexts                        [                        ane                        ])                        element                        =                        await                        driver                        .                        waitForElementById                        (                        "                        file-submit                        "                        )                        expect                        element                        .                        click                        ()                        await                        driver                        .                        quit                        ();                        }                        runTestWithCaps                        ();                                          
                                              using                        Organization                        ;                        using                        System.Threading                        ;                        using                        OpenQA.Selenium                        ;                        using                        OpenQA.Selenium.Appium                        ;                        using                        OpenQA.Selenium.Appium.iOS                        ;                        namespace                        SampleTests                        {                        grade                        UploadFile                        {                        static                        void                        Main                        (                        string                        []                        args                        )                        {                        AppiumDriver                        <                        IWebElement                        >                        driver                        ;                        AppiumOptions                        capability                        =                        new                        AppiumOptions                        ();                        adequacy                        .                        AddAdditionalCapability                        (                        "browserName"                        ,                        "iPhone"                        );                        adequacy                        .                        AddAdditionalCapability                        (                        "device"                        ,                        "iPhone 12"                        );                        capability                        .                        AddAdditionalCapability                        (                        "realMobile"                        ,                        "true"                        );                        adequacy                        .                        AddAdditionalCapability                        (                        "os_version"                        ,                        "14"                        );                        adequacy                        .                        AddAdditionalCapability                        (                        "browserstack.debug"                        ,                        "true"                        );                        capability                        .                        AddAdditionalCapability                        (                        "nativeWebTap"                        ,                        "true"                        );                        commuter                        =                        new                        IOSDriver                        <                        IWebElement                        >(                        new                        Uri                        (                        "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub/"                        ),                        capability                        );                        commuter                        .                        Navigate                        ().                        GoToUrl                        (                        "https://the-internet.herokuapp.com/upload"                        );                        Thread                        .                        Sleep                        (                        10000                        );                        commuter                        .                        FindElementById                        (                        "file-upload"                        ).                        Click                        ();                        driver                        .                        Context                        =                        "NATIVE_APP"                        ;                        commuter                        .                        FindElement                        (                        Past                        .                        Name                        (                        "Photograph Library"                        )).                        Click                        ();                        Thread                        .                        Slumber                        (                        5000                        );                        IWebElement                        element                        =                        driver                        .                        FindElementsByClassName                        (                        "XCUIElementTypeImage"                        )[                        0                        ];                        element                        .                        Click                        ();                        driver                        .                        FindElementByName                        (                        "Choose"                        ).                        Click                        ();                        driver                        .                        Context                        =                        driver                        .                        Contexts                        [                        1                        ];                        Console                        .                        WriteLine                        (                        driver                        .                        Title                        );                        driver                        .                        FindElementById                        (                        "file-submit"                        ).                        Click                        ();                        commuter                        .                        Quit                        ();                        }                        }                        }                                          
                                              <?php                        crave                        'ios_upload.php'                        ;                        class                        AppAutomateTest                        extends                        BrowserStackTest                        {                        public                        function                        sendkeys                        (                        $elem                        ,                        $keys                        )                        {                        $data                        =                        array                        (                        'value'                        =>                        str_split                        (                        $keys                        ),                        'text'                        =>                        $keys                        );                        $url                        =                        $this                        ->                        getSessionUrl                        ()                        ->                        descend                        (                        'element'                        )                        ->                        descend                        (                        $elem                        ->                        getId                        ())                        ->                        descend                        (                        'value'                        );                        $this                        ->                        getDriver                        ()                        ->                        curlicue                        (                        'Post'                        ,                        $url                        ,                        $data                        );                        }                        public                        role                        testNativeApplication                        ()                        {                        $this                        ->                        url                        (                        "https://the-cyberspace.herokuapp.com/upload"                        );                        $this                        ->                        byId                        (                        'file-upload'                        )                        ->                        click                        ();                        $this                        ->                        context                        (                        'NATIVE_APP'                        );                        $this                        ->                        byName                        (                        'Photo Library'                        )                        ->                        click                        ();                        slumber                        (                        5                        );                        $this                        ->                        elements                        (                        $this                        ->                        using                        (                        "form name"                        )                        ->                        value                        (                        "XCUIElementTypeImage"                        ))[                        0                        ]                        ->                        click                        ();                        $this                        ->                        byName                        (                        'Choose'                        )                        ->                        click                        ();                        $contexts                        =                        $this                        ->                        contexts                        ();                        $this                        ->                        context                        (                        $contexts                        [                        1                        ]);                        $this                        ->                        byId                        (                        "file-submit"                        )                        ->                        click                        ();                        }                        }                        ?>                                          
                                              from                        appium                        import                        webdriver                        from                        appium.webdriver.common.mobileby                        import                        MobileBy                        from                        selenium.webdriver.support.ui                        import                        WebDriverWait                        from                        selenium.webdriver.support                        import                        expected_conditions                        equally                        EC                        from                        selenium.webdriver.common                        import                        action_chains                        ,                        keys                        from                        time                        import                        slumber                        from                        selenium.webdriver.mutual.by                        import                        Past                        desired_cap                        =                        {                        "device"                        :                        "iPhone 12 Pro max"                        ,                        "os_version"                        :                        "14"                        ,                        "real_mobile"                        :                        "truthful"                        ,                        "browserstack.debug"                        :                        "truthful"                        ,                        "nativeWebTap"                        :                        "true"                        }                        commuter                        =                        webdriver                        .                        Remote                        (                        command_executor                        =                        'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub'                        ,                        desired_capabilities                        =                        desired_cap                        )                        driver                        .                        get                        (                        "https://the-internet.herokuapp.com/upload"                        )                        sleep                        (                        10                        )                        driver                        .                        find_element_by_id                        (                        'file-upload'                        ).                        click                        ()                        commuter                        .                        switch_to                        .                        context                        (                        'NATIVE_APP'                        )                        driver                        .                        find_element_by_name                        (                        'Photo Library'                        ).                        click                        ()                        sleep                        (                        5                        )                        elements                        =                        driver                        .                        find_elements_by_class_name                        (                        "XCUIElementTypeImage"                        )                        elements                        [                        0                        ].                        click                        ()                        # 1 represents 2nd element from the listing of 9 preloaded images and videos                                                sleep                        (                        5                        )                        driver                        .                        find_element_by_name                        (                        "Choose"                        ).                        click                        ()                        sleep                        (                        x                        )                        driver                        .                        switch_to                        .                        context                        (                        commuter                        .                        contexts                        [                        one                        ])                        commuter                        .                        find_element_by_id                        (                        "file-submit"                        ).                        click                        ()                        driver                        .                        quit                        ()                                          
                                              require                        'rubygems'                        require                        'appium_lib'                        # Input capabilities                        caps                        =                        {}                        caps                        [                        'device'                        ]                        =                        'iPhone 12'                        caps                        [                        'os_version'                        ]                        =                        '14'                        caps                        [                        'platformName'                        ]                        =                        'iOS'                        caps                        [                        'realMobile'                        ]                        =                        'true'                        caps                        [                        'name'                        ]                        =                        'BStack-[Ruby] Sample Test'                        # examination name                        caps                        [                        'build'                        ]                        =                        'BStack Build Number 1'                        # CI/CD job or build name                        caps                        [                        'nativeWebTap'                        ]                        =                        'true'                        appium_driver                        =                        Appium                        ::                        Driver                        .                        new                        ({                        'caps'                        =>                        caps                        ,                        'appium_lib'                        =>                        {                        :server_url                        =>                        "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub"                        }},                        true                        )                        commuter                        =                        appium_driver                        .                        start_driver                        driver                        .                        navigate                        .                        to                        "https://the-internet.herokuapp.com/upload"                        sleep                        (                        5                        )                        driver                        .                        find_element                        (                        xpath:                                                "//*[@id='file-upload']"                        ).                        click                        driver                        .                        set_context                        (                        'NATIVE_APP'                        )                        sleep                        (                        ten                        )                        commuter                        .                        find_element                        (                        name:                                                "Photo Library"                        ).                        click                        sleep                        (                        5                        )                        elements                        =                        driver                        .                        find_elements                        (                        :class_name                        ,                        "XCUIElementTypeImage"                        )                        elements                        [                        0                        ].                        click                        driver                        .                        find_element                        (                        name:                                                "Choose"                        ).                        click                        contexts                        =                        driver                        .                        available_contexts                        driver                        .                        set_context                        contexts                        [                        1                        ]                        driver                        .                        find_element                        (                        :id                        ,                        "file-submit"                        ).                        click                        ()                        driver                        .                        quit                        ()                                          

Uploading the files which are downloaded from the web in the same Automate session

To do this, yous'll need the download file path. The file will be downloaded in these locations on the remote desktops:

                  C:\Documents and Settings\hello\Downloads                                  

Uploading files that are downloaded in the aforementioned automate session is not possible in Android devices as of now, yet you tin upload the file from your machine to the spider web application using the pushFile() method as shown in Uploading files from your auto section

Uploading files that are downloaded in the same automate session can exist implemented on iOS devices using the following iOS snippets.

Through your exam script, y'all tin can instruct the remote browsers to:

  1. Navigate to a URL.
  2. Download a specific file.
  3. Then upload the file to the web app under examination using LocalFileDetector or pushFile and sendkeys method.
                                          import                      coffee.net.URL                      ;                      import                      coffee.util.List                      ;                      import                      java.util.Gear up                      ;                      import                      java.cyberspace.MalformedURLException                      ;                      import                      org.openqa.selenium.back up.ui.WebDriverWait                      ;                      import                      org.openqa.selenium.By                      ;                      import                      org.openqa.selenium.WebElement                      ;                      import                      org.openqa.selenium.remote.DesiredCapabilities                      ;                      import                      org.openqa.selenium.remote.RemoteWebElement                      ;                      import                      org.openqa.selenium.support.ui.ExpectedConditions                      ;                      import                      io.appium.java_client.MobileBy                      ;                      import                      io.appium.java_client.ios.IOSDriver                      ;                      import                      io.appium.java_client.ios.IOSElement                      ;                      import                      org.apache.commons.lang3.*                      ;                      public                      class                      Upload                      extends                      Thread                      {                      public                      static                      Cord                      userName                      =                      "YOUR_USERNAME"                      ;                      public                      static                      String                      accessKey                      =                      "YOUR_ACCESS_KEY"                      ;                      public                      static                      void                      chief                      (                      String                      args                      [])                      throws                      MalformedURLException                      ,                      InterruptedException                      {                      DesiredCapabilities                      caps                      =                      new                      DesiredCapabilities                      ();                      caps                      .                      setCapability                      (                      "device"                      ,                      "iPhone 12"                      );                      caps                      .                      setCapability                      (                      "os_version"                      ,                      "14"                      );                      caps                      .                      setCapability                      (                      "real_mobile"                      ,                      "truthful"                      );                      caps                      .                      setCapability                      (                      "project"                      ,                      "My Kickoff Project"                      );                      caps                      .                      setCapability                      (                      "build"                      ,                      "My First Build"                      );                      caps                      .                      setCapability                      (                      "proper noun"                      ,                      "Bstack-[Java] Sample Test"                      );                      caps                      .                      setCapability                      (                      "nativeWebTap"                      ,                      "true"                      );                      IOSDriver                      <                      IOSElement                      >                      commuter                      =                      new                      IOSDriver                      <                      IOSElement                      >(                      new                      URL                      (                      "https://"                      +                      userName                      +                      ":"                      +                      accessKey                      +                      "@hub-cloud.browserstack.com/wd/hub"                      ),                      caps                      );                      commuter                      .                      become                      (                      "https://support.staffbase.com/hc/en-united states of america/article_attachments/360009197031/username.csv"                      );                      driver                      .                      context                      (                      "NATIVE_APP"                      );                      IOSElement                      download                      =                      (                      IOSElement                      )                      new                      WebDriverWait                      (                      commuter                      ,                      30                      ).                      until                      (                      ExpectedConditions                      .                      elementToBeClickable                      (                      MobileBy                      .                      proper name                      (                      "Download"                      )));                      commuter                      .                      findElementByName                      (                      "Download"                      ).                      click                      ();                      Set                      <                      String                      >                      contextNames                      =                      driver                      .                      getContextHandles                      ();                      driver                      .                      context                      (                      contextNames                      .                      toArray                      ()[                      1                      ].                      toString                      ());                      driver                      .                      go                      (                      "https://the-internet.herokuapp.com/upload"                      );                      Thread                      .                      sleep                      (                      5000                      );                      commuter                      .                      findElement                      (                      By                      .                      id                      (                      "file-upload"                      )).                      click                      ();                      driver                      .                      context                      (                      "NATIVE_APP"                      );                      driver                      .                      findElement                      (                      By                      .                      proper noun                      (                      "Scan"                      )).                      click                      ();                      Thread                      .                      sleep                      (                      5000                      );                      driver                      .                      findElement                      (                      By                      .                      name                      (                      "Recents"                      )).                      click                      ();                      Thread                      .                      sleep                      (                      5000                      );                      IOSElement                      elem                      =                      driver                      .                      findElement                      (                      By                      .                      xpath                      (                      "//XCUIElementTypeCollectionView"                      ));                      Listing                      list                      =                      elem                      .                      findElements                      (                      Past                      .                      xpath                      (                      "//XCUIElementTypeCell"                      ));                      ((                      WebElement                      )                      listing                      .                      get                      (                      0                      )).                      click                      ();                      Thread                      .                      sleep                      (                      5000                      );                      Set                      <                      String                      >                      contextName                      =                      driver                      .                      getContextHandles                      ();                      driver                      .                      context                      (                      contextName                      .                      toArray                      ()[                      ane                      ].                      toString                      ());                      driver                      .                      findElement                      (                      By                      .                      id                      (                      "file-submit"                      )).                      click                      ();                      driver                      .                      quit                      ();                      }                      }                                      
                                          var                      wd                      =                      require                      (                      '                      wd                      '                      );                      // Input capabilities                      const                      capabilities                      =                      {                      '                      device                      '                      :                      '                      iPhone 12                      '                      ,                      '                      realMobile                      '                      :                      '                      true                      '                      ,                      '                      os_version                      '                      :                      '                      fourteen.0                      '                      ,                      '                      browserName                      '                      :                      '                      iPhone                      '                      ,                      '                      name                      '                      :                      '                      BStack-[NodeJS] Sample Examination                      '                      ,                      '                      build                      '                      :                      '                      BStack Build Number 1                      '                      ,                      "                      nativeWebTap                      "                      :                      true                      }                      async                      function                      runTestWithCaps                      ()                      {                      let                      driver                      =                      wd                      .                      promiseRemote                      (                      "                      http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub                      "                      );                      await                      driver                      .                      init                      (                      capabilities                      );                      await                      commuter                      .                      get                      (                      "                      https://support.staffbase.com/hc/en-u.s.a./article_attachments/360009197031/username.csv                      "                      );                      expect                      new                      Promise                      (                      r                      =>                      setTimeout                      (                      r                      ,                      2000                      ));                      wait                      commuter                      .                      context                      (                      '                      NATIVE_APP                      '                      );                      permit                      element                      =                      look                      driver                      .                      waitForElementByName                      (                      '                      Download                      '                      );                      expect                      element                      .                      click                      ()                      let                      contexts                      =                      await                      commuter                      .                      contexts                      ();                      await                      driver                      .                      context                      (                      contexts                      [                      1                      ]);                      await                      new                      Promise                      (                      r                      =>                      setTimeout                      (                      r                      ,                      2000                      ));                      wait                      driver                      .                      go                      (                      "                      https://the-cyberspace.herokuapp.com/upload                      "                      )                      await                      new                      Hope                      (                      r                      =>                      setTimeout                      (                      r                      ,                      2000                      ));                      element                      =                      wait                      driver                      .                      waitForElementById                      (                      '                      file-upload                      '                      )                      await                      element                      .                      click                      ()                      wait                      commuter                      .                      context                      (                      '                      NATIVE_APP                      '                      )                      element                      =                      wait                      driver                      .                      waitForElementByName                      (                      '                      Browse                      '                      )                      await                      element                      .                      click                      ()                      await                      new                      Hope                      (                      r                      =>                      setTimeout                      (                      r                      ,                      2000                      ));                      element                      =                      expect                      driver                      .                      waitForElementByName                      (                      '                      Recents                      '                      )                      await                      chemical element                      .                      click                      ()                      element                      =                      await                      driver                      .                      waitForElementByXPath                      (                      '                      //XCUIElementTypeCollectionView                      '                      )                      expect                      new                      Promise                      (                      r                      =>                      setTimeout                      (                      r                      ,                      2000                      ));                      let                      elements                      =                      await                      chemical element                      .                      elementsByXPath                      (                      "                      //XCUIElementTypeCell                      "                      )                      await                      elements                      [                      0                      ].                      click                      ()                      contexts                      =                      wait                      driver                      .                      contexts                      ();                      await                      commuter                      .                      context                      (                      contexts                      [                      1                      ])                      element                      =                      await                      driver                      .                      waitForElementById                      (                      "                      file-submit                      "                      )                      expect                      element                      .                      click                      ()                      await                      driver                      .                      quit                      ();                      }                      runTestWithCaps                      ();                                      
                                          using                      System                      ;                      using                      Organisation.Threading                      ;                      using                      OpenQA.Selenium                      ;                      using                      OpenQA.Selenium.Appium                      ;                      using                      OpenQA.Selenium.Appium.iOS                      ;                      namespace                      SampleTests                      {                      class                      UploadFile                      {                      static                      void                      Primary                      (                      cord                      []                      args                      )                      {                      AppiumDriver                      <                      IWebElement                      >                      commuter                      ;                      AppiumOptions                      capability                      =                      new                      AppiumOptions                      ();                      capability                      .                      AddAdditionalCapability                      (                      "browserName"                      ,                      "iPhone"                      );                      capability                      .                      AddAdditionalCapability                      (                      "device"                      ,                      "iPhone 12"                      );                      adequacy                      .                      AddAdditionalCapability                      (                      "realMobile"                      ,                      "true"                      );                      adequacy                      .                      AddAdditionalCapability                      (                      "os_version"                      ,                      "14"                      );                      capability                      .                      AddAdditionalCapability                      (                      "browserstack.debug"                      ,                      "truthful"                      );                      capability                      .                      AddAdditionalCapability                      (                      "nativeWebTap"                      ,                      "true"                      );                      driver                      =                      new                      IOSDriver                      <                      IWebElement                      >(                      new                      Uri                      (                      "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-deject.browserstack.com/wd/hub/"                      ),                      capability                      );                      driver                      .                      Navigate                      ().                      GoToUrl                      (                      "https://back up.staffbase.com/hc/en-the states/article_attachments/360009197031/username.csv"                      );                      driver                      .                      Context                      =                      "NATIVE_APP"                      ;                      driver                      .                      FindElement                      (                      By                      .                      Name                      (                      "Download"                      )).                      Click                      ();                      driver                      .                      Context                      =                      commuter                      .                      Contexts                      [                      1                      ];                      driver                      .                      Navigate                      ().                      GoToUrl                      (                      "https://the-internet.herokuapp.com/upload"                      );                      Thread                      .                      Sleep                      (                      10000                      );                      driver                      .                      FindElementById                      (                      "file-upload"                      ).                      Click                      ();                      driver                      .                      Context                      =                      "NATIVE_APP"                      ;                      commuter                      .                      FindElement                      (                      By                      .                      Proper noun                      (                      "Browse"                      )).                      Click                      ();                      driver                      .                      FindElement                      (                      By                      .                      Proper name                      (                      "Recents"                      )).                      Click                      ();                      IWebElement                      element                      =                      driver                      .                      FindElementByXPath                      (                      "//XCUIElementTypeCollectionView"                      );                      element                      .                      FindElements                      (                      By                      .                      XPath                      (                      "//XCUIElementTypeCell"                      ))[                      0                      ].                      Click                      ();                      driver                      .                      Context                      =                      driver                      .                      Contexts                      [                      i                      ];                      Console                      .                      WriteLine                      (                      driver                      .                      Championship                      );                      commuter                      .                      FindElementById                      (                      "file-submit"                      ).                      Click                      ();                      commuter                      .                      Quit                      ();                      }                      }                      }                                      
                                          <?php                      require                      'android_upload.php'                      ;                      class                      AppAutomateTest                      extends                      BrowserStackTest                      {                      public                      function                      sendkeys                      (                      $elem                      ,                      $keys                      )                      {                      $data                      =                      assortment                      (                      'value'                      =>                      str_split                      (                      $keys                      ),                      'text'                      =>                      $keys                      );                      $url                      =                      $this                      ->                      getSessionUrl                      ()                      ->                      descend                      (                      'element'                      )                      ->                      descend                      (                      $elem                      ->                      getId                      ())                      ->                      descend                      (                      'value'                      );                      $this                      ->                      getDriver                      ()                      ->                      gyre                      (                      'Mail service'                      ,                      $url                      ,                      $data                      );                      }                      public                      function                      testNativeApplication                      ()                      {                      $this                      ->                      url                      (                      "https://back up.staffbase.com/hc/en-us/article_attachments/360009197031/username.csv"                      );                      $this                      ->                      context                      (                      'NATIVE_APP'                      );                      $this                      ->                      byName                      (                      'Download'                      )                      ->                      click                      ();                      $contexts                      =                      $this                      ->                      contexts                      ();                      $this                      ->                      context                      (                      $contexts                      [                      i                      ]);                      $this                      ->                      url                      (                      "https://the-net.herokuapp.com/upload"                      );                      $this                      ->                      byId                      (                      'file-upload'                      )                      ->                      click                      ();                      $this                      ->                      context                      (                      'NATIVE_APP'                      );                      $this                      ->                      byName                      (                      'Browse'                      )                      ->                      click                      ();                      $this                      ->                      byName                      (                      'Recents'                      )                      ->                      click                      ();                      $this                      ->                      byXpath                      (                      "//XCUIElementTypeCollectionView"                      );                      $this                      ->                      elements                      (                      $this                      ->                      using                      (                      'xpath'                      )                      ->                      value                      (                      '//XCUIElementTypeCell'                      ))[                      0                      ]                      ->                      click                      ();                      $contexts                      =                      $this                      ->                      contexts                      ();                      $this                      ->                      context                      (                      $contexts                      [                      one                      ]);                      $this                      ->                      byId                      (                      "file-submit"                      )                      ->                      click                      ();                      }                      }                      ?>                                      
                                          from                      appium                      import                      webdriver                      from                      appium.webdriver.common.mobileby                      import                      MobileBy                      from                      selenium.webdriver.back up.ui                      import                      WebDriverWait                      from                      selenium.webdriver.support                      import                      expected_conditions                      as                      EC                      from                      selenium.webdriver.mutual                      import                      action_chains                      ,                      keys                      from                      fourth dimension                      import                      sleep                      from                      selenium.webdriver.common.by                      import                      By                      desired_cap                      =                      {                      "device"                      :                      "iPhone 12"                      ,                      "os_version"                      :                      "14"                      ,                      "real_mobile"                      :                      "truthful"                      ,                      "browserstack.debug"                      :                      "true"                      ,                      "nativeWebTap"                      :                      "true"                      }                      driver                      =                      webdriver                      .                      Remote                      (                      command_executor                      =                      'http://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub'                      ,                      desired_capabilities                      =                      desired_cap                      )                      # download file                                            driver                      .                      get                      (                      "https://support.staffbase.com/hc/en-us/article_attachments/360009197031/username.csv"                      )                      # take download                                            commuter                      .                      switch_to                      .                      context                      (                      'NATIVE_APP'                      )                      driver                      .                      find_element_by_name                      (                      'Download'                      ).                      click                      ()                      driver                      .                      switch_to                      .                      context                      (                      driver                      .                      contexts                      [                      1                      ])                      # go to upload url                                            commuter                      .                      get                      (                      "https://the-internet.herokuapp.com/upload"                      )                      sleep                      (                      10                      )                      commuter                      .                      find_element_by_id                      (                      'file-upload'                      ).                      click                      ()                      driver                      .                      switch_to                      .                      context                      (                      'NATIVE_APP'                      )                      driver                      .                      find_element_by_name                      (                      'Browse'                      ).                      click                      ()                      driver                      .                      find_element_by_name                      (                      'Recents'                      ).                      click                      ()                      element                      =                      driver                      .                      find_element_by_xpath                      (                      "//XCUIElementTypeCollectionView"                      )                      print                      (                      blazon                      (                      element                      ))                      element                      .                      find_elements_by_xpath                      (                      "//XCUIElementTypeCell"                      )[                      0                      ].                      click                      ()                      driver                      .                      switch_to                      .                      context                      (                      commuter                      .                      contexts                      [                      1                      ])                      commuter                      .                      find_element_by_id                      (                      "file-submit"                      ).                      click                      ()                      driver                      .                      quit                      ()                                      
                                          require                      'rubygems'                      require                      'appium_lib'                      # Input capabilities                      caps                      =                      {}                      caps                      [                      'device'                      ]                      =                      'iPhone 12'                      caps                      [                      'os_version'                      ]                      =                      '14'                      caps                      [                      'platformName'                      ]                      =                      'iOS'                      caps                      [                      'realMobile'                      ]                      =                      'true'                      caps                      [                      'name'                      ]                      =                      'BStack-[Ruby] Sample Test'                      # test name                                            caps                      [                      'build'                      ]                      =                      'BStack Build Number i'                      # CI/CD job or build proper noun                      caps                      [                      'nativeWebTap'                      ]                      =                      'true'                      appium_driver                      =                      Appium                      ::                      Driver                      .                      new                      ({                      'caps'                      =>                      caps                      ,                      'appium_lib'                      =>                      {                      :server_url                      =>                      "https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-deject.browserstack.com/wd/hub"                      }},                      true                      )                      commuter                      =                      appium_driver                      .                      start_driver                      driver                      .                      navigate                      .                      to                      "https://back up.staffbase.com/hc/en-u.s.a./article_attachments/360009197031/username.csv"                      driver                      .                      set_context                      (                      'NATIVE_APP'                      )                      driver                      .                      find_element                      (                      xpath:                                            "//*[@name='Download']"                      ).                      click                      contexts                      =                      driver                      .                      available_contexts                      driver                      .                      set_context                      contexts                      [                      ane                      ]                      driver                      .                      navigate                      .                      to                      "https://the-internet.herokuapp.com/upload"                      sleep                      (                      five                      )                      driver                      .                      find_element                      (                      xpath:                                            "//*[@id='file-upload']"                      ).                      click                      driver                      .                      set_context                      (                      'NATIVE_APP'                      )                      sleep                      (                      ten                      )                      driver                      .                      find_element                      (                      xpath:                                            "//*[@name='Scan']"                      ).                      click                      sleep                      (                      five                      )                      driver                      .                      find_element                      (                      xpath:                                            "//*[@proper noun='Recents']"                      ).                      click                      element                      =                      commuter                      .                      find_element                      (                      :xpath                      ,                      "//XCUIElementTypeCollectionView"                      )                      element                      .                      find_elements                      (                      xpath:                                            "//XCUIElementTypeCell"                      )[                      0                      ].                      click                      contexts                      =                      commuter                      .                      available_contexts                      driver                      .                      set_context                      contexts                      [                      one                      ]                      commuter                      .                      find_element                      (                      :id                      ,                      "file-submit"                      ).                      click                      ()                      driver                      .                      quit                      ()                                      

We're sorry to hear that. Please share your feedback so we tin can exercise better

Contact our Back up team for firsthand help while we piece of work on improving our docs.

We're continuously improving our docs. We'd beloved to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes

No

Nosotros're deplorable to hear that. Please share your feedback then we can do better

Contact our Support team for immediate help while we piece of work on improving our docs.

We're continuously improving our docs. Nosotros'd beloved to know what y'all liked





Thank you for your valuable feedback!

barberbeffers72.blogspot.com

Source: https://www.browserstack.com/docs/automate/selenium/test-file-upload

0 Response to "Wait Until File Is Uploaded to Disk Django"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel