Keyboard.Press

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Keyboard.Press

Post by omayer » Wed Nov 07, 2012 10:31 pm

Nothing happenned when using following code, trying tab down to the control Keyboard.Press("{TAB}");
Delay.Ms(2000);

Keyboard.KeyDown("{RETURN}");
Delay.Ms(2000);
Tipu

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Keyboard.Press

Post by Ciege » Wed Nov 07, 2012 10:37 pm

Instead of a Keyboard.KeyDown("{RETURN}"); use Keyboard.Press("{ENTER}");
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Keyboard.Press

Post by omayer » Wed Nov 07, 2012 10:46 pm

thank you Ciege, will try pressEnter
Tipu

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Keyboard.Press

Post by omayer » Thu Nov 08, 2012 9:23 pm

same result, not getting control move by using tab or Enter
Tipu

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Keyboard.Press

Post by Ciege » Thu Nov 08, 2012 9:45 pm

Does it move when you use TAB manually?
Do you have focus set to the AUT AND to an existing control where TAB order would make sense?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Keyboard.Press

Post by omayer » Thu Nov 08, 2012 9:52 pm

If i TAB manually it moves but when i try automate it doesn't , here is the method i am using

Code: Select all

public void CheckedWFH(string _wfh)
       {
       	if(_wfh=="Yes")
       	{
      	
       	 bool found = false;
  
       		
           	WebDocument webDocument = "/dom[@page='index.cfm']";    	
        	InputTag  findWfh; 			
			found = webDocument.TryFindSingle("/dom[@page='index.cfm']//input[@Id='chkWorkFromHome']", 50000, out findWfh);

				if (!found)  
				{  
				    throw new Ranorex.ElementNotFoundException("WFH checkbox was not found", null);                  
				} 
				
				else
				{ 		         
					
					findWfh.EnsureVisible();
					findWfh.PerformClick();
					Delay.Ms(5000);
					Keyboard.Press("{TAB}");
					Delay.Ms(2000);
					
					Keyboard.Press("{ENTER}");
					Delay.Ms(2000);
					
				}
				
       	}
       	
  }
Tipu

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Keyboard.Press

Post by Ciege » Thu Nov 08, 2012 10:17 pm

So according to your code you find the element findWfh.
If it is found you click on the element findWfh.
Does the above two steps work? Did you click on the input element?

Are you sure that a single TAB from that point is proper to move to the next item you want highlighted?
Is any item getting highlighted? Maybe your tab is not making it to the proper item because of tab order or number of tabs needed.
Why are you using TAB anyway? Why not just click on the element? Can you find the element?
Please make sure the exact steps you have coded are the steps you perform manually.

Also, change your PerformClick to a Click and PerformClick does not move the mouse and actually click the element. Instead it just send the click action to the element.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Keyboard.Press

Post by omayer » Thu Nov 08, 2012 10:45 pm

Thank you Ciege, after changing PerformClick to a Click now able to click on OK and continue the step. Thank you Again
Tipu