Ranorex and Selenium End point - Reset content of Text Input

Ranorex Studio, Spy, Recorder, and Driver.
bberrabah
Posts: 26
Joined: Wed Dec 20, 2017 6:18 pm

Ranorex and Selenium End point - Reset content of Text Input

Post by bberrabah » Fri Feb 09, 2018 5:23 pm

Hello Forum;

I am using Ranorex with Selenium Endpoint for technical reasons (Cannot call the Ranorex Agent remotely).

I need to reset the content of each Control before introduce business Data, so i coded a Utility Method

Code: Select all

		public static void ClearText(Ranorex.Adapter a)
		{
			Report.Log(ReportLevel.Info,"Content Reset " + a);
	                a.PressKeys("{END}{SHIFT DOWN}{HOME}{SHIFT UP}{DELETE}");		
			Report.Log(ReportLevel.Info,"Reset OK " + a);
			
		}
When using Selenium Endpoint i have an Error during execution, saying that the "{END}" is not known key. So i tried to updat emy code by using the keyboard capabilities.

Code: Select all

	   a.Click();
            Keyboard.Press(System.Windows.Forms.Keys.End, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
            Keyboard.Press(System.Windows.Forms.Keys.Home | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.Control, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
            Keyboard.Press(System.Windows.Forms.Keys.Delete, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
But this does not work too.

Any idea please?

Best regards

bberrabah
Posts: 26
Joined: Wed Dec 20, 2017 6:18 pm

Re: Ranorex and Selenium End point - Reset content of Text Input

Post by bberrabah » Mon Feb 12, 2018 3:54 pm

Finally; i got one solution like this.

Code: Select all

public static void ClearText(Ranorex.Adapter a)
{
	Report.Log(ReportLevel.Info,"Reset du contenu de " + a);
	a.As<InputTag>().TagValue ="";
}
Best regards