Hello,
I've run into weird scenarios trying to figure out how to automate a QT app.
On my developer machine it works to automate the app. However, when I use the app on another computer, it doesn't work anymore.
Are there any best practices regarding QT that I should take care of, in order to make it always-work ?
About identifying QT dialogs
Re: About identifying QT dialogs
Hi,
Could you please post exact error message you are getting? Also, please post a Ranorex snapshot (NOT screenshot!) of the problematic element, ideally, taken on both machines, so we can see the difference. And don't forget to post the xpath, which works on one system, but fails on another. Thanks.
Could you please post exact error message you are getting? Also, please post a Ranorex snapshot (NOT screenshot!) of the problematic element, ideally, taken on both machines, so we can see the difference. And don't forget to post the xpath, which works on one system, but fails on another. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: About identifying QT dialogs
Hello,
Here's the repository that is working on my machine:
Its pretty similar on the other machine, only the IDs are different
Also I manually changed the paths to be a little more specific, as in the following:
"/form[@title='JasminCam' and @processname='JCam-main' and @appname='JasminCam']/text[@name='mPasswordTxt']"
In code I do something like this:
There are no errors reported. However, it behaves like its not finding the QT app/dialog and/or element.
Here's the repository that is working on my machine:
Code: Select all
<repository
id="85a0f281-3bea-4c58-8576-b1bff4024695"
name="JasminCam"
rxversion="8.1">
<codegen
classname="JasminCamV4"
namespace="MyTestProject">
</codegen>
<rootfolder
capname="host"
id="cf155ac2-ac04-495b-894c-1bb9fecd9123"
isrooted="True"
name="Root"
searchtimeout="3000ms"
usecache="False">
<appfolder
addcaps="form,qtelement,qtwindow,nativewindow"
capname="form"
id="05eb089e-e8b5-4fef-a8be-2359a7d7198c"
isrooted="True"
name="Login"
refpath="/form[@title='JasminCam']"
searchtimeout="3000ms"
usecache="True">
<item
addcaps="text,qtelement"
capname="text"
id="6d22f41f-0ddd-4f46-b4a4-f19dac359c62"
name="MPasswordTxt"
refimgid="e46b70cf-6598-48b7-b5d0-709815f27c06"
refpath="/form[@title='JasminCam']/text[@name='mPasswordTxt']"
searchtimeout="3000ms">
/form[@title='JasminCam']/text[@name='mPasswordTxt']
</item>
<basepath>
/form[@title='JasminCam']
</basepath>
<icon>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAGbSURBVDhPpZE7TwJREIVnsaFAC21MxEZjoZ0J
xgd/wMqGRhNIiLFR44NEfwCJJrTU2lOJ7xeuqKhrcBGJoBijQRPNtlhJd5zZsEhBoVJ8Z2bOzJ3k
3ktZItQDZVjqgdIsv+G2hidQikXQa0Qrr1VbHl2zVHM/OIT3YBApR5NZJ5mcqw8foRCMcBhPIyNI
KorpS5+uWCw05nlxAaXSF/T2drN+mZnDaySChMuF0+4ePCwv4dHnq5yhC1LwAyEfCKBY/MQVL9A7
OvG2swvVZjN758wJE2ekFijBIpyVY3Z2FoZh4NLpxJ3fj5TXW+lJrM4lkmyztkpMT0+hUCgg0eaE
7vXhhhdIrxYyTyqLRdxuhz4/j3w+j3hrK1S+Ro7vrzY0VGaOquYFOmSJMdrwMB7TN8jdZpBci+KA
X/pAeqNjyK6uQHO7cdHbiwz/kObxQM4JtMcibDoasTc+jv2JCURbmtlTTH+bWevqQmxyEsf8wOv9
A9hkb78M7ZSHJG4x0pR8txytXPyNKs+C5NBfkWVWTuss9UBRvuv/UfAN4oDtyrDwuZMAAAAASUVO
RK5CYII=
</icon>
</appfolder>
<basepath>
</basepath>
</rootfolder>
<variables>
</variables>
</repository>
Also I manually changed the paths to be a little more specific, as in the following:
"/form[@title='JasminCam' and @processname='JCam-main' and @appname='JasminCam']/text[@name='mPasswordTxt']"
In code I do something like this:
Code: Select all
Stopwatch sw = new Stopwatch();
Boolean found = false;
sw.Start();
while (!found)
{
// here i try validating the existance of the app
found = Ranorex.Validate.Exists(@"/form[@title='JasminCam' and @processname='JCam-main' and @appname='JasminCam']",
"Check for dialog existance... 'JasminCam'", false);
if (sw.Elapsed.TotalSeconds > 10)
break;
}
Boolean did = false;
if (!did)
{
MyTestProject.JasminCamV4 jsm = MyTestProject.JasminCamV4.Instance;
e.Result = false;
jsm.Login.SelfInfo.WaitForExists(new Ranorex.Duration(30 * 1000));
try
{
if (jsm.Login != null && jsm.Login.MPasswordTxt != null)
{
jsm.Login.MPasswordTxt.EnsureVisible();
jsm.Login.MPasswordTxt.TextValue = site.Password;
e.Result = true;
did = true;
}
}
catch (Exception ex)
{
e.Result = ex.Message;
}
}
// try the other file
if (!did)
{
MyTestProject.JasminCam_Win7 jsm = MyTestProject.JasminCam_Win7.Instance;
e.Result = false;
jsm.Login.SelfInfo.WaitForExists(new Ranorex.Duration(30 * 1000));
try
{
if (jsm.Login != null && jsm.Login.MPasswordTxt != null)
{
jsm.Login.MPasswordTxt.EnsureVisible();
jsm.Login.MPasswordTxt.TextValue = site.Password;
e.Result = true;
did = true;
}
}
catch (Exception ex)
{
e.Result = ex.Message;
}
}
There are no errors reported. However, it behaves like its not finding the QT app/dialog and/or element.
Re: About identifying QT dialogs
Hi,
Please post the snapshot from both machines. If the ids are different on both machines, then you need to make the xpaths resistent to these changes. Unfortunately, without seeing, at very least, Ranorex snapshot (from both systems), there is no way anyone here can suggest better xpaths. Thanks.
Please post the snapshot from both machines. If the ids are different on both machines, then you need to make the xpaths resistent to these changes. Unfortunately, without seeing, at very least, Ranorex snapshot (from both systems), there is no way anyone here can suggest better xpaths. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: About identifying QT dialogs
Attached files to this reply.
Later Edit:
I added some debug logs on the runtime machine:
No element found for path '/form[@name='Login' and @processname='JCam-main']' within 10s.
No element found for path '/form[@name='Login' and @processname='JCam-main']/text[@name='mPasswordTxt']' within 5s.
No element found for path '/form[@title='JasminCam' and @processname='JCam-main' and @appname='JasminCam']/text[@name='mPasswordTxt']' within 5s.
Later Edit:
I added some debug logs on the runtime machine:
No element found for path '/form[@name='Login' and @processname='JCam-main']' within 10s.
No element found for path '/form[@name='Login' and @processname='JCam-main']/text[@name='mPasswordTxt']' within 5s.
No element found for path '/form[@title='JasminCam' and @processname='JCam-main' and @appname='JasminCam']/text[@name='mPasswordTxt']' within 5s.
You do not have the required permissions to view the files attached to this post.
Re: About identifying QT dialogs
On my machine, here is how it looks in spy:
While on the target machine, here's how it looks:
You do not have the required permissions to view the files attached to this post.
Re: About identifying QT dialogs
Hi,
The first problem I see is, that you are using different versions of Ranorex on both machines! You must use the same Ranorex version everywhere, otherwise, the results could be different: As you can see, newer version of Ranorex (installed on Win7 machine) shows significantly more details about QT elements. There is a note in 8.2.1 release notes, that there is added support for QT tooltips. But it may be that they generally improved QT support?
Additionally, because you are using different versions of Windows, you will most probably have to optimize the xpaths on both systems. There is no way around. You see, things could look and behave differently on various systems. So if using the same Ranorex version on all systems does not fix your problem, you will have to find common xpaths, which will work on all systems.
BTW, make sure there is installed the same version of tested app on all systems and that there are installed the same versions of QT libs, .net and VC++ redistributable libs. Using the same versions of everything is essential for successful automation!
The first problem I see is, that you are using different versions of Ranorex on both machines! You must use the same Ranorex version everywhere, otherwise, the results could be different: As you can see, newer version of Ranorex (installed on Win7 machine) shows significantly more details about QT elements. There is a note in 8.2.1 release notes, that there is added support for QT tooltips. But it may be that they generally improved QT support?
Additionally, because you are using different versions of Windows, you will most probably have to optimize the xpaths on both systems. There is no way around. You see, things could look and behave differently on various systems. So if using the same Ranorex version on all systems does not fix your problem, you will have to find common xpaths, which will work on all systems.
BTW, make sure there is installed the same version of tested app on all systems and that there are installed the same versions of QT libs, .net and VC++ redistributable libs. Using the same versions of everything is essential for successful automation!
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: About identifying QT dialogs
Hey there,
Thanks for all the assistance.
Meanwhile I also discovered myself that I did something wrong when deploying the app:
1. i didn't had all vc++ redistributables installed
2. as of the runtimes... i only copied the DLL files, but forgot to also copy the subfolders
Doing the 2 points above, made it work. Many thanks
Thanks for all the assistance.
Meanwhile I also discovered myself that I did something wrong when deploying the app:
1. i didn't had all vc++ redistributables installed
2. as of the runtimes... i only copied the DLL files, but forgot to also copy the subfolders
Doing the 2 points above, made it work. Many thanks
Re: About identifying QT dialogs
Hi,
You are welcome. Nice to hear you solved the problem
You are welcome. Nice to hear you solved the problem
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration