I’m trying to input value into a postal code field but once after moving to next field the postal code value automatically disappers,
WebElement branchPostalCode = WebUiCommonHelper.findWebElement(findTestObject(‘Object Repository/Create Branch/Page_Add Branch/input_Postal Code_ctl00ContentPlaceHolder1t_4fbdc5’), 30)
Why are you not setting the value with
I tried WebUI.SetText(), but it is not entering the value at all in the field.
Is your test object using the id?
What happens when you put this in the browser console:
document.querySelector("put-the-id-here").value = "post code here"
Sorry, the id must start with “#”
document.querySelector("#your-id").value = "post code here"
ids start with “#”
classes start with dot “.”
tag names can be used directly “div”
The error is saying, there is no tag with that name (which is absolutely correct )
So we proved your id works. What did the page do? Did it accept the value or did it disappear?
It accepted the value and didn’t disappear.
So, let’s change your JS code to this:
String js = 'document.querySelector("#your-id").value = "post code here"'
Make sure you don’t miss the different quote characters.
Let me know if it retains the post code in the field.
It worked perfectly! Thank you!