Hello,
Please help me with the below iddue.
- I set the username field and password field to some text say
Username: 1test1@test.com
Password: test
- Now I clear the field using the below code
@Keyword
def static clearElementText(TestObject to) {
WebElement element = WebUiCommonHelper.findWebElement(to,30)
WebUI.executeJavaScript(“arguments[0].value=’’”, Arrays.asList(element))
}
and then
TestObject to = findTestObject(‘Login/input_Email’)
CustomKeywords.‘react.methods.clearElementText’(to)
- Now I have cleared the field with the above code(which works). But when I try to set the same Username field with some other text- say
WebUI.setText(findTestObject(‘Login/input_Password’), “test”)
The Username field fills like below
1test1@test.comtest
- Or if i try to fill it in with no text using
WebUI.setText(findTestObject(‘Login/input_Password’), " ")
It sets itself to the initial Username field which is
1test1@test.com
Basically, by default it fill the field by the very first input. Please let me know if anyone has any solution for this.
I can provide with more details and screenshots if required.
@ini.ramesh Sorry, it’s off topic, but what about clearing the text with using
WebUI.clearText(findTestObject(‘Login/input_Password’))
Perhaps the browser is trying to “help” you by remembering inputs?
I can fix this using JavaScript to target the fields. But that would change your code significantly.
Let me know.
@Russ_Thomas Thanks so much for the response. I dont think it is trying to remember. Let me share a screenshot of how it is concatenating the input to the previous ones when I try to clear the text and add a new username in the field everytime in the same test script.
Also, when I clear the field it behaves like it has already cleared it. But when I run the step again, it jumps on to the very 1st input I give and concatenates the next input with the 1st one.
Also- clearText is not working with Mac-Chrome combo which we are using to test.
I’m intrigued.
Are you familiar with DevTools? Can you try setting the field from using the DevTools console? It will look something like this:
document.querySelector("css-selector-for-your-field").value = "someone@somewhere.com"
If you share more info (screenshots of the HTML using DevTools Inspector) then we can make this work in Katalon/Groovy quite easily.
1 Like
Thanks Russ- Will get back with the details ASAP! Really appreciate your timely response.
1 Like
Is this issue has been resolved? I’m encountering the same behavior which cause error