How to upload a file in Mobile Browser

@Elly_Tran @vu.tran @duyluong
How to upload a file in Mobile Browser. Below is the sample url

https://the-internet.herokuapp.com/upload

I have set up the Mobile browser automation using the below documentation.

You can try with the UploadFile keyword on WebUI first and try with mobile.

1 Like

@quan.trinh

The upload is not working, the page is crashing. I ran the test on a physical device.

Mobile_Upload_File

It looks like you found a bug in the AUT…

@mwarren04011990 Manually - In mobile device it is working fine. Only via automation it is failing.

The file to be uploaded into Mobile Web Browser, is placed in my Laptop (C:\Users\UserName\Desktop\TEST.pdf). Is that OK?

@Elly_Tran @vu.tran @duyluong, @ThanhTo , @Jass
Kindly help. Your help is higly appreciated.

mhm, i am not familiar with mobile testing, so you can call me stupid.
for my eyes, you are testing a certain application on a mobile device.
but the file to upload is on your PC from where you start the test.

something does not fit here…

perhaps the file should be on the mobile device also?

Hi,

I have the same guess as @bionel . Can you please try upload the same file to web browser (Firefox, Chrome, etc) first to test whether your file is valid or uploadFile by Katalon is working well? Follow this doc or this video. As well, please help provide us the log you receive.

1 Like

My Script is working fine in Chrome & Firefox browser in Windows 10 Desktop.

Thanks, I have followed the document & Video as well.

In case of Mobile browser testing, where should the “file to uploaded” be placed?

Is there any other additional configuration / settings to done in case mobile browser upload. Kindly Clarify.

Thanks :slightly_smiling_face:

I read How to upload / attach file using Appium | Selenium Easy in order to understand how people test uploading files in Mobile. In this article, when you started uploading, you want to choose a file from “Files” folder on the Mobile device.

Files


I think, you must do a preprocessing: you have to somehow transfer the file from your Windows’ C:\Users\UserName\Desktop\TEST.pdf into the Mobile device’s "Files" folder. Only after you have prepared the fixture file, you can test uploading the file from the Mobile devices’ "Files" folder.

How to prepare the file on the Movile devices’ “Files” folder? ---- I don’t know. Possibly you want to bundle the fixture PDF file in the APK file?

Wherevere you like, is your device.
C:\Users\UserName\Desktop\TEST.pdf cannot be a valid path, since there is no way to mount your PC drive into the mobile device.
E.g for my android device, i am opening the Files application, go to whatever folder, long tap on a certain file to select it, and from More > Details I can see what is the path.

See:

You can either download the file from a certain location straight on your phone, or upload it via data cable.

I have pasted my pdf file in the android device.

WebUI.uploadFile(findTestObject('Upload_File'), '/storage/emulated/0/Download/dummy.pdf')

But still the script is failing.

Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: unknown error: path is not absolute: /storage/emulated/0/Download/dummy.pdf

are you sure that is the right absolute path, from your device point of view?
you are not reading fully our hints, so we cannot help you anymore.
the only think i can suggest right now is, change your username into discover.appium
cheers!

The absolute path is correct to best of my knowledge.

your knowledge may be wrong.
that is from adb point of view.

LE: ok, i was nasty but you don’t help us much.
explore the file path from the device point of view, i already gave some hints