Script not running when WebUiCommonHelper is used

I recorded a simple login script and when I used the WebUiCommonHelper to store the webelements in a variable (screenshot), the script failed to run. I am not sure what is it that I’m doing wrong. May someone assist?

Note: if I use WebUI.setText(findTestObject(‘Object Repository/Page_eCOIDA - Powered by CompSol/input_Username_username’), ‘mzulu’) the script runs fine. The issue here seems to be WebUiCommonHelper because even if I do not call or use the variables the script doesn’t run until remove/comment out the WebUiCommonHelper statements.

the exception is self explanatory, browser not opened.
move the new lines after the ‘navigate to url’

I thought that was the case at first but it isn’t, please see screenshot below. I also have a note section in the main post

now it’s a different issue.
findTestObject expects an test object as argument, but you are passing a WebElement to it (username)

userName = findTestObject(‘txtUserName’) option works fine. Thanks for help.

Interest sake: Though I’m still confused as to what is the right way to use WebUiCommonHelper method findWebElement.

i realy have no clue,never used it … perhaps somebody more experienced with UI voodoo can bring some light

Hi @mdu_kay7

WebUI.findWebElement() takes in a TestObject and returns a Selenium WebElement. On the other hand, findTestObject() expects a string representing the path of a test object’s ID. This is why using:

works.

In your script, you’re passing userPassword which is a Selenium WebElement into findTestObject, therefore the exception says that there’s no method with the name findTestObject that accepts such an argument.

Hope that helps.

Cheers !

1 Like

so, on short … you have to decide, use one way or the other way.
don’t mix them
@ThanhTo i hope i was reading right your explanation

2 Likes