Dear all,
I’m trying to manipulate webelements’ values through javascript setAttribute command, but I experience some weird behaviour.
This is my custom method:
def jsWrite(TestObject to, String input) {
WebElement element = WebUiCommonHelper.findWebElement(to,30)
WebUI.executeJavaScript("arguments[0].setAttribute(‘value’, " + input + “)”,Arrays.asList(element))
}
It works perfectly with this:
jsWrite(findTestObject(‘Object Repository/myobj’),‘1234’)
It means It works when I pass numbers as strings…
but it fails when I try to pass letters instead of numbers…as string…
jsWrite(findTestObject(‘Object Repository/myobj’),‘abcd’)
it says:
=============== ROOT CAUSE =====================
Caused by: org.openqa.selenium.JavascriptException: Error from JavaScript: ‘abcd’ not defined
what am I missing here?
thank you all
d