How do I run existing tests made on chrome on a nw.js program using object repository?

I am working with a program that can be accessed via chrome and URL or via a nw.js client. by changing the chromedriver and setting the binary I am able to interact with the web page, as follows:

WebElement searchBox = driver.findElement(By.xpath(‘//*[@id=\‘bsh\’]’))

searchBox.sendKeys(‘ChromeDriver’)

However, this bypasses the object repository that all of my larger tests use. When I try to create a WebElement using the TestObject like this:

WebElement site =(WebElement)findTestObject(‘NewClientopening/SiteId’)

I get the error:

Cannot cast object ‘TestObject - ‘Object Repository/NewClientopening/SiteId’’ with class ‘com.kms.katalon.core.testobject.TestObject’ to class ‘org.openqa.selenium.WebElement’

How can I convert from TestObject to WebElement? Or is there a better way to use the object repository on a nw.js program?
Thanks

I sincerely hope you get this to work! The ability to test nw.js apps would be a cool thing indeed.

I’ve never used this, but it’s supposed to be the way to do it:

WebElement element = WebUiCommonHelper.findWebElement(findTestObject('your/object'),30)

More help here: https://docs.katalon.com/display/KD/Troubleshooting+common+issues+related+to+interacting+with+an+element

Thanks for your response!

Because the driver that references the nw.js application is not used in finding the web element, but rather the WebUiCommonHelper is, it fails because no browser is opened- it doesn’t recognize the application:
FAILED because (of) com.kms.katalon.core.webui.exception.BrowserNotOpenedException: Browser is not opened

Is there a way to change the settings of WebUi to look to my application instead of to a nonexistent browser to find elements?

No idea, sorry. Wonder if @Trong Bui or @Vinh Nguyen knows?

Hi,

Test Object in Katalon Studio is not really a Web Element which we can perform actions on it. Test Object is just an object storing locators and other information.
We could get the Web Element by the findWebElement command as below:

WebElement web_element = WebUiBuiltInKeywords.findWebElement(test_object)