Hi
I have a sceanrio where I need to verify whether the cursor focus is on paticular textbox or not.
So for this I tried using 'HasFocus' property of the object but it is displaying result as 'false' for both the conditions.
Can we have any other way to verify the cursor focus is on particular object or not?
Thanks,
Rakesh
HasFocus property not working
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: HasFocus property not working
Hi,
To get the correct snapshot please open your application and open Spy. Now instant track the control you want and then press the scroll key on your keyboard.
Thanks in advance.
Regards,
Peter
Ranorex Team
Would it be possible to post us a Ranorex Snapshot of this control using the "SCROLL" key snapshot.Rakesh123 wrote:Can we have any other way to verify the cursor focus is on particular object or not?
To get the correct snapshot please open your application and open Spy. Now instant track the control you want and then press the scroll key on your keyboard.
Thanks in advance.
Regards,
Peter
Ranorex Team
Re: HasFocus property not working
Hi Peter,
As u have asked for the snap shot.I am sending the snapshot.
Please reply me ASAP.
As this is some show stopper for one of my test case.
Thanks
Rakesh
As u have asked for the snap shot.I am sending the snapshot.
Please reply me ASAP.
As this is some show stopper for one of my test case.

Thanks
Rakesh
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: HasFocus property not working
Hello Rakesh,
Do you get the correct value in Spy?
According to your snapshot, the following Text seems to have the focus:
Please let me know which TextBox do you want to validate.
Do you perform a mouse-click on your TextBox?
Regards,
Markus (T)
Do you get the correct value in Spy?
According to your snapshot, the following Text seems to have the focus:
Code: Select all
/form[@title='Patient Search']/text[5]
Do you perform a mouse-click on your TextBox?
Regards,
Markus (T)
Re: HasFocus property not working
Hi Markus,
I think that I have send you the wrong attachment.
Please find the attached snap shot where I am facing the problem.
I have also attached my application snap shot where I am facing this problem.
Following are the details about the application..
---------------------------------------------------------
1.Technology:Delphi
2.OS:Windows 7
Thanks,
Rakesh
Thanks,
Rakesh
I think that I have send you the wrong attachment.
Please find the attached snap shot where I am facing the problem.
I have also attached my application snap shot where I am facing this problem.
Following are the details about the application..
---------------------------------------------------------
1.Technology:Delphi
2.OS:Windows 7
Thanks,
Rakesh
Thanks,
Rakesh
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: HasFocus property not working
Hello Rakesh,
How do you verify if an element has the focus?
Do you use something similar to the following code:
This could happen during saving a snapshot since Spy takes over it.
Please describe all your steps that you did.
This would help us to reproduce it on our system.
Regards,
Markus (T)
How do you verify if an element has the focus?
Do you use something similar to the following code:
Report.Info("Focus: " + repo.FormVipApplication.FirstName.HasFocus);Regarding your snapshot, no element has the focus.
This could happen during saving a snapshot since Spy takes over it.
Please describe all your steps that you did.
This would help us to reproduce it on our system.
Regards,
Markus (T)
Re: HasFocus property not working
Hi,
Below is the process how I used to check the has focus property..
1.Open the application i.e 'Patient Search' screen(Screen shot mentioned below)
2.Place the cursor in textbox i.e 'Last Name textbox in 'Patient Search' screen
3.Track the object(Last Name textbox).
4.Check the details tab in Ranorex Spy.
While doing this "HasFocus' property is displaying false value
Thanks,
Rakesh
Below is the process how I used to check the has focus property..
1.Open the application i.e 'Patient Search' screen(Screen shot mentioned below)
2.Place the cursor in textbox i.e 'Last Name textbox in 'Patient Search' screen
3.Track the object(Last Name textbox).
4.Check the details tab in Ranorex Spy.
While doing this "HasFocus' property is displaying false value
Thanks,
Rakesh
Re: HasFocus property not working
If you click off of the item, into Spy for example when you "Track", then that item will not have focus, Spy will have focus. So, this appears to be working as expected/intended.
Maybe the question should be, why do you need to validate that the text box has focus when you just clicked it? If you are actually entering data into the field and it doesn't have focus, that step should fail anyway.
Maybe you can explain your test case a little more and we can help you figure you out the best way to approach it?
Maybe the question should be, why do you need to validate that the text box has focus when you just clicked it? If you are actually entering data into the field and it doesn't have focus, that step should fail anyway.
Maybe you can explain your test case a little more and we can help you figure you out the best way to approach it?
Shortcuts usually aren't...
Re: HasFocus property not working
Hi,
No the test case is not like click on the textbox & validate.
Actually we need to change some settings in the application & then we need to verify that as per that setting the focus is on the particular textbox or not.
Ok,What you said may be correct like when we click on track button in Ranorex spy may be the focus is shifted to Ranorex spy.
I will just check it out let you know whether it is working or not.
Thanks,
Rakesh
No the test case is not like click on the textbox & validate.
Actually we need to change some settings in the application & then we need to verify that as per that setting the focus is on the particular textbox or not.
Ok,What you said may be correct like when we click on track button in Ranorex spy may be the focus is shifted to Ranorex spy.
I will just check it out let you know whether it is working or not.
Thanks,
Rakesh