Running JavaScript on Web Elements Embedded in a Windows Application
HI,
I have a Windows application that includes embedded web fields, and I need to run JavaScript to perform certain actions on these web elements. However, running JavaScript with a browser will only work with actual browsers. In my case, I need a solution to execute JavaScript directly on the web elements within the Windows application. How can I achieve this?
Any suggestions or guidance would be Greatly appreciated.
Note: Tried Capturing with all three technologies, but not working for many fields
@Micah.Smith
Page 1 / 1
I might be wrong, but I don’t think it’s possible to execute JavaScript code on an application unless the application exposes an entry point to allow it.
It is also possible that the recorder is working partially, and the application is failing to recognize the click. When you capture an object (regardless of the technology), are the properties in the recorder action populated?
Hello @Stefano 5934 ,
You are correct. When I execute JavaScript using the JavaScript package in Automation Anywhere to click or set text, I encounter a bot error.
I have also tried using Record Capture:
Active Accessibility: No properties were populated.
UI Automation: While I was able to click on a few elements, I could only see the path as a property. In some cases, the bot displayed a success message, but the click action did not actually occur.
UI Automation (COM): I observed both the path and name as properties, but the path appeared to be dynamic.
In conclusion, I have identified several limitations with Record Capture. Therefore, I would like to write some JavaScript to interact with the elements, as I can retrieve the ID or DOMx Path from the web fields. This approach would be more robust.
Note :- I believe Application will support to run JS, Only thing want to know, how to establish a connection between Application and JS
Best Regards,
Sridhar
There might be a way to achieve what you want but it might not be very straight forward.
I found some sources that would be a good starting point to research and eventually achieve what you're trying to do.
If you're still willing to try using the recorder action, you could try adding wildcard in the Path property, like so: 1|1|2|1|*|3|2
It would also be helpful to have more details about the application that you're trying to automate.
Was it developed in-house? Or is it a well-known / public app?
Hello @Stefano 5934 ,
I appreciate your suggestion to use the Selenium library. I will look into how it interacts with the application.
I attempted to use a wildcard in the path, but unfortunately, it did not work, as the sequence "1|1|2|1|*|3|2" matches multiple instances.
The application in question is Facets Gemstone, which I believe is developed by Cognizant TriZetto Group. From what I have seen, it does not appear to be a public application.
Please feel free to share any thoughts or additional suggestions you may have.
Thank you.
I went down a rabbit hole trying to find information on Facets Gemstone, and in the end, I found two possible matches.
The first one, developed by TriZetto, doesn't appear to have any public UI samples / images that I could use for reference, however, I did find something "Open Access Solution", which appears to be one of their products / services intended to help with automation and interoperability.
The second match does mention the term Gemstone, which is never mentioned in any of the TriZetto materials, but alas, I couldn't find any images of the UI online. Nevertheless, the websites where the term "GemStone Facets” is mentioned also mention Java:
Which makes me wonder if your application might be based on java, and there could be a misunderstanding between java and javascript. If this is the case, then you might be able to use the regular recorder actions:
Just to be sure, when you run the GemStone Facets program, what's the name and extension of the program as shown in the task manager?
I appreciate your effort in doing research. Let me provide some information that might help us narrow down the challenge.
The application we are using is Facets Interactive (referred to as Gemstone Facets by the client, depending on the environment we select), which is a Windows application (possibly built using Java). Once we enter the application, the tab we open navigates to a web page within the same application. The fields we see are entirely web-based (we can inspect the elements using F12, similar to a web page in a browser). It displays the full HTML page. Since it is a web page, I thought of injecting JavaScript to speed things up and improve efficiency.
In addition to that, I have tried using Record Capture with all three technologies. However, there are some elements that are not functioning as expected (for instance, extracting a table and validating a couple of dropdowns).
Infact If I capture any element with record capture - it says windows element, not the Web(Can’t put any custom Domx Path)
Note: Client Restricted Any external Java related installations in the machines as per the security reasons
FYR, I'm attaching the Task Manager Snapshot.
Please Feel free to add your comments/thoughts on this
Thanks
When you press F12, do you see a tab called "console"?