Zoomba: Windows Desktop: Regular expression on Window name

Window name of the desktop application that I wish to automate, might include the version information which might change quite often.

For example, the window name today is “Sample App - 1.0.0” and it might be changed to “Sample App - 2.3.1”

Is there a way to use regular expression on the window name (like Sample App*) for opening a desktop application?

Hey @viswabharathi,

I answered something similar just a few minutes ago actually haha.

This currently won’t work but seeing as there is some need here I will start looking into it very soon.

I went ahead and put something together quickly. Currently its just in a branch if you could give it a try:

To install simply clone the branch, open a command prompt, navigate to the repository root and run:

pip install .

For the keyword you will now just need to supply your partial window_name (without any extra regex characters) and set ‘exact_match’ to False

Switch Application By Name | http://localhost:4723 | window_name=Sample App | exact_match=False

Let me know if that works for you!

This has since been released: https://github.com/Accruent/robotframework-zoomba/releases/tag/2.5.7

Hi Wolfe1,

Thanks for the response. It doesn’t seem to be working. I have upgraded the Zoomba library.

Name: robotframework-zoomba
Version: 2.5.7
Summary: Robot Framework mini-framework.
Home-page: https://github.com/Accruent/zoomba
Author: None
Author-email: None
License: GPL-3.0
Location: c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages
Requires: requests, robotframework-seleniumlibrary, robotframework-sudslibrary-aljcalandra, msedge-selenium-tools, python-dateutil, robotframework-appiumlibrary, psutil, robotframework-requests, selenium, robotframework
Required-by:

I have the following line in my code:

Open Application ${winAppDriverUrl} app=C:/Windows/System32/notepad.exe window_name=Notepad exact_match=False

Notepad got opened but it was not attached.

Got the following error:
Error finding window "Notepad" in the desktop session. Is it a top level window handle?

@viswabharathi Taking a look now, will get back to you soon.

This should be addressed now in the latest release: https://github.com/Accruent/robotframework-zoomba/releases/tag/2.6.0

Let me know if that works

Unfortunately, it doesn’t work still after update. It is the same result as before.

I found the following in the WinAppDriver console:

POST /session/B7CFCC8B-FC93-45BD-A924-66BD6DE90051/element HTTP/1.1
Accept: application/json
Accept-Encoding: identity
Connection: keep-alive
Content-Length: 122
Content-Type: application/json;charset=UTF-8
Host: 127.0.0.1:4723
User-Agent: appium/python 1.0.2 (selenium/3.141.0 (python windows))

{"using": "xpath", "value": "//Window[contains(@Name, \"Notepad\")]", "sessionId": "B7CFCC8B-FC93-45BD-A924-66BD6DE90051"}
HTTP/1.1 404 Not Found
Content-Length: 139
Content-Type: application/json

{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

Please see if it helps.

Python version: 3.8.0
WinAppDriver version: 1.1

Hmmm, could you update to the latest version of winappdriver and try?

Version 1.2.1 was released last week:

@viswabharathi This is what I get using Zoomba 2.6.0 and Winappdriver 1.2.1:

Test file: scratch_17.robot (740 Bytes)

Results: https://i.imgur.com/REHc9dj.gif

@Wolfe1, Thanks for the support. It worked with the WinAppDriver 1.2.1.

1 Like

@viswabharathi Excellent! Please raise an issue on github if you run into any other issues or have enhancement requests in the future!

Good information thanks for sharing
VMware Engineer

@Wolfe1 I just copied the same code and ran in my local, I am getting the following error.


I am new and learning. Any help will be appreciated.

Did you install WinAppDriver at the default location? Seems the issue is that the driver never starts so the test can never reach it:

image

Yes, I tried But I am unable to see that in the services. Let me take a look one more time.

@Wolfe1 I found the reason, My laptop was not in developer’s mode. I changed it and ran the exe, it started working
Thanks for your support.

1 Like