This is a migrated thread and some comments may be shown as answers.

Type text in textbox focus problem

1 Answer 148 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 14 Mar 2012, 02:53 PM
Hi!

I'm new to the Telerik tool and are for the moment evaluating it against Selenium webdriver.
But I have come across a problem where I need some help.

I'm trying to write a test for typeahead but are having problem with focus when I run the test on a testserver.

If I set the text directly I will not be able to validate the typeahead.
textBox.Text = "some text";

(textBox is here an HtmlInputText)

If I use the keyboard, I will be able to validate it, but if I run the test on for example a testserver (or if I minimize the browser) it doesn't work.

textBox.Focus();
textBox.Click();
var desktop = new Desktop();
var keyb = new KeyBoard(desktop);
keyb.TypeText("some text");
keyb.KeyPress(Keys.Tab);

Is there any other way to do this so I don't need to have focus on the browser?

Regards,

1 Answer, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 19 Mar 2012, 12:43 PM
Hello Robert,

The possible reason for such a behavior is that you did not find the right element for the text box and as a result you are probably writing in a wrong text box. Please note, that if you are using the new rendering mode - Single Input Rendering (which is set by default since Q1`2012), the text box element, which you should find is the same as the name of the control, unlike the old rendering mode, where the text box element contains  "_text".
Another possible approach is to find the client object of the control with the client side API.

Please let me know if additional information is needed.

Kind regards,
Milena
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Milena
Telerik team
Share this question
or