My problem is that I find the element in a certain web page where I want to set a text and then I do something like this:
WebElement elementCI = WebUiCommonHelper.findWebElement(findTestObject(‘Object Repository/Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’),
But the way this is working is that when I enter this page, the text is already in its place and then its deleted. As this happnes, the element I need to wait to appear does not appear. This is not an error you would see in the log. I know something is wrong or missing but I do not know what. Maybe I need to simulate an enter or something, I dont know. Could you please help me?
Your problem must be caused by something else (without seeing more of the code/page it’s hard to suggest what that might be).
Thats the problem, the test works fine and it passes.
In this test case I try to login in to the web and access a page called Carga de Ordenes
Then enter the ID of a person
Wait for something to appear
Enter something else and finish
This enters the text but then deletes it right away so after that nothing happens and the text passes correctly
This is the script I have:
WebUI.setText(findTestObject(‘Page_Login/input_User Name_vUSERNAME’), ‘admin’)
WebUI.setEncryptedText(findTestObject(‘Page_Login/input_User Password_vUSERPASSWORD’), ‘hUKwJTbofgPU9eVlw/CnDQ==’)
WebUI.click(findTestObject(‘Page_Inicio/a_Carga de rdenes’))
WebUI.waitForElementVisible(findTestObject(‘Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’), 5)
WebElement element = WebUiCommonHelper.findWebElement(findTestObject(‘Object Repository/Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’),
- Do I need to import something extra? add a special keyword? Do something that I am not doing? Is my script wrong?
Thanks for the help
Trust me, if what you say is happening is true, then the world wide web is broken - time to run for the hills.
Show me a screen capture of the element in question when you bring it up in the developer tools. If you use Firefox, we can see if there are events attached (which my be causing your problem).
Thank you very much for the help. If I encounter this problem again (even with my solution) I will tell you
Hi Russ, im having the same problem, the value atribute is not changing using WebUI.executescript
It may not appear in the value attribute of the DOM. Your code changes the value property.
thanks for your answer Russ, yes, my code sets the date (as you can see on the image) but if i inspect the dom, the value atribute continues empty and when i interact with the next object, this date value dissapier.
You can find out what is stored in the birthdate field in the devtools console:
That will retrieve the value stored the value property.
That’s because that’s not what the code does - it modifies the value PROPERTY. To modify the attribute, you need a different API - but that would be the WRONG thing to do.
thanks a lot.
for your info, js.executeScript(“document.getElementById(‘birthDate’).setAttribute(‘value’, ‘1990-01-01’)”); its working, the dom value is filled but the value dissapier when i click in the next object