Web Page inside WPF application

I am new to windows app automation. Our application is made WPF framework. We are using RPA.Windows for automation.
Whereas the login page is WPF window with webpage inserted inside the window. RPA.Windows library is not recognizing the elements in the Login page. When I inspect the page elements, ** FrameworkId** for the elements is shown as Chrome. Below is the screenshot.

Appreciate any help in automating the login page.


You should still be able to use the name attribute for this application. For example:
For this application locator works as:

Click    name:"Robocorp Test C:\\Bizagi\\Projects\\RobocorpTest"

I tired the same but getting element not found error, below is the error received

RPA.Windows . Click name:"Email"

|Documentation:|Mouse click on element matching given locator.|
| --- | --- |
|Tags:|action, mouse|
|Start / End / Elapsed:|20231026 11:32:27.802 / 20231026 11:32:38.225 / 00:00:10.423|

11:32:27.805 INFO Getting element with locator: name:"Email"

11:32:27.954 INFO Resulted root element: WindowsElement(item=<uiautomation.uiautomation.PaneControl object at 0x000001A6D61D5CD0>, locator=None, name='Desktop 1', automation_id='', control_type='PaneControl', class_name='#32769', left=0, right=1920, top=0, bottom=1080, width=1920, height=1080, xcenter=960, ycenter=540)

11:32:27.954 INFO Locator 'name:"Email"' produced matcher: MatchObject(locators=[('Name', 'Email', 0)], _classes=set(), max_level=0)

11:32:38.219 INFO 2023-10-26 11:32:38.218 locators.py[274] _get_control_from_params -> Find Control Timeout(10s): {Name: 'Email'}

11:32:38.219 FAIL ElementNotFound: Element not found with locator 'name:"Email"'

You don’t need to use quotation marks if your selector does not contain spaces. The actual selector depends on your application structure, for example you should consider element depth. You can find more information from documentation RPA.Windows library | Robocorp documentation

I tried with and without quotation marks, same error shown.
Also I tried using Print Tree to get the element depth, but the output of “Print Tree” does not have the elements of the login page, say Email element is not found

Did you read the documentation and noted about max depth? Depending on your application structure your elements might be nested deeper than default.

1 Like

@raivo Yeah you are right, the element structure is nested deeper inside. Referred Using path: locator strategy with Windows library - Robocorp Portal and used windows-record -v command to capture the path.
Path i got is path:9|2|1|1|1|2|1|1|1|2|1|1|3|2|1|1|2|1|2|1|1|2|1|1|2|1|1

Used the path with Click keyword Click path:9|2|1|1|1|2|1|1|1|2|1|1|3|2|1|1|2|1|2|1|1|2|1|1|2|1|1 it throws error as ElementNotFound: Unable to retrieve child on position 2 under a parent with partial path ‘9’

Hello @krevathitest

Hi Revathi,

It seems like you’re dealing with a hybrid application that has both WPF and web components. In this case, you might need to use a combination of libraries to interact with different parts of your application.

For the WPF part of your application, you can continue using the RPA.Windows library. However, for the web components, you might need to use a library that can interact with web elements, such as RPA.Browser.Selenium. This library can interact with elements in a web page, even if it’s embedded inside a WPF application.

Here’s a simple example of how you can use RPA.Browser.Selenium to interact with web elements:

from RPA.Browser.Selenium import Selenium

def login_to_app():
browser = Selenium()
browser.input_text(‘username_locator’, ‘your_username’)
browser.input_text(‘password_locator’, ‘your_password’)

Thanks & Cheers!!!

Thanks for sharing the info.
Web elements were nested inside the app, I am able to interact with the elements using Get Element keyword by passing root_element attribute



That’s great to hear! Using the Get Element keyword with the root_element attribute is indeed a good approach when dealing with nested web elements.

1 Like

This topic was automatically closed 8 hours after the last reply. New replies are no longer allowed.