can't press button in WPF application : Automation API

can't press button in WPF application

Class library usage, coding and language questions.

can't press button in WPF application

Postby Koen » Thu Jan 12, 2012 10:45 am

Ranorex 2.3

I want to press a button within a wpf application but it fails. Below the code and the error.
This code works on a normal windows form ( ex.calculator ).
What is wrong here ?

Code: Select all
Form form = Host.Local.FindChild<Ranorex.Form>("'^Version:\\ 11\\.45\\.4391\\.36066']");
            form.Activate();
            Button button = form.FindChild<Ranorex.Button>("Button2");
            button.Click();


Code: Select all
Test Failed Ranorex.CapabilityNotSupportedException: The element does not support the required capability 'button'.


Thanks,
Koen
Koen
 
Posts: 2
Joined: Thu Jan 12, 2012 10:38 am

Re: can't press button in WPF application

Postby Support Team » Thu Jan 12, 2012 12:05 pm

Hi,

Are you sure that the element you are trying to click on is button? - It seems to be another element, no button.

Please try to track the element with Ranorex Spy to get out the type of the element.
But you can also cast it to Ranorex.Unknown and click on it.

The best way would be to use the element with Ranorex Repository instead of using a hard coded path.
To do this, also check out the documention of using repository in your user code.

Regards,
Martin
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: can't press button in WPF application

Postby sham526 » Fri Jan 13, 2012 8:01 am

Just Try like this

ranorex.unknown btn = home.Findsingle<unknown>("./Button2");
btn.click();
sham526
 
Posts: 17
Joined: Wed Jul 07, 2010 8:12 am
Location: Hyderabad(INDIA)

Re: can't press button in WPF application

Postby Koen » Fri Jan 13, 2012 11:55 pm

THE element I was trying to click was a text.
Thanks for THE feedback
Koen
 
Posts: 2
Joined: Thu Jan 12, 2012 10:38 am


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests