Home > Back-end >  Wanting to automate the process of upload documents - Tried robot class but failed in browserstack.
Wanting to automate the process of upload documents - Tried robot class but failed in browserstack.

Time:09-21

Thanks for stopping by. I have a piece of code to automate. Bit of a background: I wanted to automate a upload functionality. I tried sending the path through key press event and was successful to run it locally. Then I ran the same script in browserStack and it failed. Tried debugging but no luck.

Then I tried send keys to upload but that too fails because the way the upload button is implemented is that after the file is choosing and uploaded, the test files names are created in new tags - I am attaching the tag so it would make sense.

Before upload - its only TD tag

<td id="td1" class="upload">

After upload there is a new tag P appended to the script.

 <td id="td" class="upload">
                    <p class="doc"><a href="#">doc.doc</a> <span class="deleteLink" href="#" onclick="commonJs.deleteFile">
<i class="material-icons delete">close</i></span></p></td>

Any work around on uploading a file to this tag ?

thanks in advance

CodePudding user response:

BrowserStack only supports Selenium and Appium commands. Robot actions are Abstract Window Toolkit actions and are not Selenium commands, hence those are not supported on BrowserStack.

Also, you can refer sample code and website provided and make changes accordingly on the website.

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

CodePudding user response:

Would be great if you would have shown the code and error you get through Browserstack. Uploading file when running through browserstack might have failures due to the unavailability of the resource to be uploaded in the remote device in the path mentioned. If this the case, try out the workarounds mentioned in their website.

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

  • Related