Ranorex

Accessibility BUG?

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore
View previous topic :: View next topic  
Author Message
martinbilski



Joined: 21 Sep 2007
Posts: 3

PostPosted: Fri Sep 21, 2007 12:26 pm    Post subject: Accessibility BUG?
Hi,

I'm evaluating RanorexCore to automate acceptance tests for our application but I'm having problems with accessibility features.

Here's the link to the application:
http://www.xtreeme.com/followupxpert/FollowUpXpertInstallPro.exe

What I have problem with is accessing toolbar buttons. The application uses CodeJock (www.codejock.com) toolbar and apparently it doesn't work with your API. The reason I'm contacting you instead of CodeJock is that I believe there may be a bug in your API because Microsoft's AccExplorer displays and handles all toolbar elements correctly. Here's how it looks like in AccExplorer:



This is the element I'm trying to access. I tried the following:

Case 1. RxElementFindChild(&mainWindow, 0, "Send/Receive", NULL, &button)

Case 2. Iterating recursively over the elements to find one whose name matches "Send/Receive". When I do the latter, the following happens for the inner "xtpBarTop" element (you can see there are two nested elements with that name) -> RxElementGetChildCount returns the right number of elements (2) but the elements have empty names:
Code: click into code to enlarge

...
[Parent = xtpBarTop]
   Child =
   Child =
...

while, according to AccExplorer, it should look like this:
Code: click into code to enlarge

...
[Parent = xtpBarTop]
   Child = Standard
   Child = Menu Bar
...


Then trying to iterate over the first element (called "Standard" in the last listing) results in RxElementGetChildCount returning 7 but then RxElementGetChild for the third child element *fails*.

Could you please see what is causing this discrepancy between Microsoft's AccExplorer and your API? Thank you.

Below the code that will reproduce the bug (both cases described above). I removed all error checking code and replaced it with ASSERTs to make it more legible.

Note: You may need to change the path to the executable.

Case 1:
Code: click into code to enlarge

      RxApplicationStart ("C:/Program Files/FollowUpXpert/FollowUpXpert.exe");
      HWND hwnd = RxFormFindClassName ("Xtreeme.FollowUpXpert.3.MainWndClassName");

      ASSERT (NULL != hwnd);

      ElementStruct mainWindow;
      ASSERT (RxControlGetElement (hwnd, &mainWindow));

      ElementStruct child;
      ASSERT (FALSE == RxElementFindChild (&mainWindow, 0, "Send/Receive", NULL, &child));


Case 2:
Code: click into code to enlarge
      RxApplicationStart ("C:/Program Files/FollowUpXpert/FollowUpXpert.exe");
      HWND hwnd = RxFormFindClassName ("Xtreeme.FollowUpXpert.3.MainWndClassName");

      ASSERT (NULL != hwnd);

      ElementStruct mainWindow;
      ASSERT (RxControlGetElement (hwnd, &mainWindow));

      ElementStruct outerBarTop, innerBarTop;
      ASSERT (RxElementFindChild (&mainWindow, 0, "xtpBarTop", NULL, &outerBarTop));
      ASSERT (RxElementFindChild (&outerBarTop, 0, "xtpBarTop", NULL, &innerBarTop));
      ASSERT (2 == RxElementGetChildCount (&innerBarTop));

      ElementStruct standard;
      ASSERT (RxElementGetChild (&innerBarTop, 0, &standard));
      ASSERT (0 != strcmp (standard.Name, "Standard"));   // BUG: The name should be "Standard".

      ASSERT (7 == RxElementGetChildCount (&standard));

      ElementStruct child;
      ASSERT (RxElementGetChild (&standard, 0, &child));
      ASSERT (RxElementGetChild (&standard, 1, &child));
      ASSERT (FALSE == RxElementGetChild (&standard, 2, &child)); // BUG: There are 7 elements!


I'm testing using Windows XP Pro.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Fri Sep 21, 2007 1:54 pm    Post subject:
Please try the following code:
(Thank you for the application and for the good description)

Code: click into code to enlarge
// Finding form by titel
HWND form = RxFormFindTitle("FollowUpXpert - DEMO VERSION");   
if ( form == 0 )
{
   printf(" ERROR: Application not found\n");
   exit(1);
}

// Find the T O O L B A R
printf("Toolbar\n");
HWND hToolbar = ::RxFormFindChildClassName(form, "XTPToolBar");
if ( hToolbar == 0 )
{
   printf("    ERROR: Toolbar not found\n");
   exit(1);
}

// Get the Element of the Toolbar
ElementStruct element;
if ( RxControlGetElement(hToolbar, &element) == FALSE)
{
   printf("    ERROR: Toolbar GetElement\n");
   exit(1);
}

// Find and click the Send/Receive button
ElementStruct sendReceiveButton;
BOOL bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Send/Receive", NULL, &sendReceiveButton);
if (bRet==TRUE)
{
   printf("    SendReceive button found\n");
   ::RxMouseClickElement(&sendReceiveButton);
}

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
martinbilski



Joined: 21 Sep 2007
Posts: 3

PostPosted: Fri Sep 21, 2007 3:28 pm    Post subject:
Nope, the code you sent doesn't work on my machine. Does it work on yours?

Details: It finds the toolbar all right, but not the button.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Fri Sep 21, 2007 3:54 pm    Post subject:
Quote:
Does it work on yours?

Yes, I tried also the Start and Stop buttons, they all work in my machine.
I use your demo version and have an english Windows XP.

Code: click into code to enlarge
// Find and click the Start button
ElementStruct startButton;
bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Start", NULL, &startButton);
if (bRet==TRUE)
{
   printf("    Start button found\n");
   //RxElementSelect(&listItem, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
   ::RxMouseClickElement(&startButton);
}

// Find and click the Stop button
ElementStruct stopButton;
bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Stop", NULL, &stopButton);
if (bRet==TRUE)
{
   printf("    Stop button found\n");
   //RxElementSelect(&listItem, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
   ::RxMouseClickElement(&stopButton);
}

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
martinbilski



Joined: 21 Sep 2007
Posts: 3

PostPosted: Fri Sep 21, 2007 4:06 pm    Post subject:
Could you send the project you used? Also, are you using v1.2? Thanks!
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Fri Sep 21, 2007 4:15 pm    Post subject:
Here my sourcecode, a command line application:

Code: click into code to enlarge
#include "stdafx.h"
#include "RanorexCore.h"

int _tmain(int argc, _TCHAR* argv[])
{
   RxSetSleepTime(150);
   RxMouseSetMoveTime(500);

   // Finding form by titel
   HWND form = RxFormFindTitle("FollowUpXpert - DEMO VERSION");   
   if ( form == 0 )
   {
      printf(" ERROR: Application not found\n");
      exit(1);
   }

   // Find the T O O L B A R
   HWND hToolbar = ::RxFormFindChildClassName(form, "XTPToolBar");
   if ( hToolbar == 0 )
   {
      printf("    ERROR: Toolbar not found\n");
      exit(1);
   }

   // Get the Element of the Toolbar
   ElementStruct element;
   if ( RxControlGetElement(hToolbar, &element) == FALSE)
   {
      printf("    ERROR: Toolbar GetElement\n");
      exit(1);
   }

   // Find and click the Send/Receive button
   ElementStruct sendReceiveButton;
   BOOL bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Send/Receive", NULL, &sendReceiveButton);
   if (bRet==TRUE)
   {
      printf("SendReceive button found\n");
      ::RxMouseClickElement(&sendReceiveButton);
   }

   // Find and click the Start button
   ElementStruct startButton;
   bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Start", NULL, &startButton);
   if (bRet==TRUE)
   {
      printf("Start button found\n");
      ::RxMouseClickElement(&startButton);
   }

   // Find and click the Stop button
   ElementStruct stopButton;
   bRet = RxElementFindChild(&element, ROLE_SYSTEM_PUSHBUTTON, "Stop", NULL, &stopButton);
   if (bRet==TRUE)
   {
      printf("Stop button found\n");
      ::RxMouseClickElement(&stopButton);
   }

   RxSleep(3000);
   
   exit(0);
}


Quote:
are you using v1.2?


Yes

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum