I'm trying to write some test scripts which involves uploading a file via Chrome. I'm using Selenium's RemoteWebDriver in order to test the web application using Chrome on a Samsung Note 10 device.
I've managed to write the script up to the point of clicking on the file upload button which in turn bring up the file upload control asking me which type of file I'd like to upload. However since this is not a web control I can't interact with it using RemoteWebDriver. I tried to create a new instance of AppiumDriver but since an instance of RemoteWebDriver already exists I'm unable to create a new instance of AppiumDriver.
Is there anyway I could go about this issue? I tried to cast RemoteWebDriver as a AppiumDriver (despite feeling that it wouldn't work) but it wasn't possible.
You can start the test with AndroidDriver initialization instead of RemoteWebDriver.
The reason to this is its implementation:
So, you will have something like:
Now, you can use AppiumDriver methods. You can upload file with in-built technique that WebDriver provide for this.
The main idea behind it is to directly send the absolute path to the file to an element which you would usually click at to get the modal window - that is
<input type='file' />
element.