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?
Wolfe1
(Brandon Wolfe)
4 November 2020 19:52
2
Hey @viswabharathi ,
I answered something similar just a few minutes ago actually haha.
Hey @kiran ,
The main bits that you want out of accessibility insights are listed at the top of the doc page here .
[image]
When using the tool you simply need to roll over your element and see what options are available to you:
[image]
I suggest filtering this list down to make it easier to use as there is a lot of extra information there.
To find xpath you will need to use the recorder provided by winappdriver here .
The way the code is laid out I don’t think this is currently possible.…
This currently won’t work but seeing as there is some need here I will start looking into it very soon.
Wolfe1
(Brandon Wolfe)
4 November 2020 21:31
3
I went ahead and put something together quickly. Currently its just in a branch if you could give it a try:
Accruent:master
← Accruent:window_name_regex
opened 09:22PM - 04 Nov 20 UTC
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!
Wolfe1
(Brandon Wolfe)
5 November 2020 22:09
4
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?
Wolfe1
(Brandon Wolfe)
9 November 2020 15:36
6
@viswabharathi Taking a look now, will get back to you soon.
Wolfe1
(Brandon Wolfe)
9 November 2020 18:39
7
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
Wolfe1
(Brandon Wolfe)
10 November 2020 13:56
9
Hmmm, could you update to the latest version of winappdriver and try?
Version 1.2.1 was released last week:
Wolfe1
(Brandon Wolfe)
10 November 2020 17:01
10
@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
Wolfe1
(Brandon Wolfe)
17 November 2020 15:39
12
@viswabharathi Excellent! Please raise an issue on github if you run into any other issues or have enhancement requests in the future!
wiljames
(jamesalawx)
19 January 2021 11:27
13
Good information thanks for sharing
VMware Engineer
nanduIyer
(Nandu Iyer)
13 January 2022 18:02
14
@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.
Wolfe1
(Brandon Wolfe)
13 January 2022 20:34
15
Did you install WinAppDriver at the default location ? Seems the issue is that the driver never starts so the test can never reach it:
nanduIyer
(Nandu Iyer)
13 January 2022 22:20
16
Yes, I tried But I am unable to see that in the services. Let me take a look one more time.
nanduIyer
(Nandu Iyer)
13 January 2022 22:50
17
@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