TestProject Forum

Safari from browserstack integration unable to perform any "Clear Contents" action

When attempting to perform any “clear contents” action using the Safari browser through browserstack’s virtual agent, the action fails due to a timeout exception with only the error message “Failed clearing element: text is ‘[the text in the input field that should have been removed]’”. The selectors are finding the text fields just fine, since the error message does not say “Element was not found” and even manages to successfully read the content of the input field that it is supposed to clear. This issue occurs consistently, with the action failing three times out of three total uses in my test suite on three totally separate webpages. I’ve included a screenshot of the error message.

image

Bumping this thread because I haven’t yet found a solution to this. Error is still occurring consistently on all three of my tests that use this action, and is still only present on Safari, but not Chrome, Firefox or Edge.

Hello @samuelshagan
Try to use Execute JavaScript action:
document.getElementById(“ElementID”).value=""


Please put your element ID.

You can also use a ClassName as well:
document.getElementsByClassName(“ClassName”)[0].value=""
image
Using ClassName returns an array and you will need to selects the index as well.

Please let me know if it works.

@kfir.yosef Setting the value of the input does not work, the next action that interacts with the form causes the old value to repopulate the input. We’re using Formik for these forms, which implements controlled React inputs, so the values of the inputs are stored as separate state variables rather than simply relying on the value properties of the input fields. I think this is just setting the value of the input without updating the state variables, so the values aren’t actually changing internally.

@samuelshagan It sounds like a private case.
Please contact us via chat and we will check together what we can do to overcome it.