Does uploadFileWithDragAndDrop work on phones?


I have successfully used uploadFileWithDragAndDrop while testing an application via a web browser (Chrome & FireFox), for example …

def filePath = GlobalVariable.UploadFilePathvar + ‘one.jpg’

WebUI.uploadFileWithDragAndDrop(findTestObject(‘Object Repository/Page_Camden QA (4)/span_Browse. or drag’), filePath)

When I use TestOps and try and run the test on an phone rather than a browser (I’ve tried iphone, samsung,goolge) it fails …

com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_Camden QA (4)/span_Browse. or drag’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)

Has anybody ever to got it to work on a phone?
Is there another way of doing this?
Am I just dumb?

i don’t think it is the locator I am using as the html for both the website and phone are identical in that respect.
It may be that on a phone browsing for a file has an additional step and uploadFileWithDragAndDrop doesn’t account foe that?

Hi @barry.reid ,

Thank you for your concern. In terms of your issue, I will scope it down into 3 main potential causes:

  1. The performances of web browser versus emulator are different; therefore, there might be some timing problem when loading the items. It means when the test is running on the phone, the element has not been loaded / clickable yet. I will suggest that you should add some delays for the test to run by WebUI.waitForElementClickable, WebUI.waitForElementVisible, Delay or Thread.sleep().

  2. After you try the first suggestion but still does not work, it can be the scrolling issue due to the difference in display screen. Follow this document if needed.

  3. It is acknowledged that this is the common error with automation testing tool when we cannot find the element because the Xpath is duplicated somewhere or too general. To deal with this, you can help optimize it by providing a better XPath which means to be unique. Your HTML Xpath is recommended to contain unique Id field.
    There is one workaround that you can try by adding POM Builder extension in Google so that it can automatically copy your Xpath under the best format. Then, you can provide it to the test case.

  4. After all if you still do not find any ways helpful, please try to find the object by other things such as: CSS Selector, ALT Identifier, .etc.

In the long run, our team will plan to publish a post to propose suggestions for your problem and relevant ones. We will let you know then.

Hope these suggestions can help your issue. Thank you!

Thank you for the suggestions, most of which I have tried before. I added again a WebUI.waitForElementClickable & WebUI.waitForElementVisible. As you can see from the results, the element is visible and clickable, then the next step says it is not able to click. I’ve also added a screenshot taken as the test runs, you can clearly see the file upload control, you also see a message at the top saying ‘no files selected’ maybe this is the issue as it finds the file every time in web browser


Have you tried the option 3 and 4? If you have tried them and not been able to solve problem yet, I will ask for investigation internally and get back to you soon.


Yes I have tried options 3 and 4, in fact I had tried everything you have suggested before I posted on this forum. I do not think the problem is that the element can not be found, as the screenshot above shows, it is visible and clickable, then the very next step says it is not clickable.
I am far from being an expert in this but it looks to me that a mobile device handles a file upload slightly differently that a web browser. Has anyone every got uploadFileWithDragAndDrop to work on a mobile device?