This question is locked. New answers and comments are not allowed.
Archana Sathyanarayan
Top achievements
Rank 1
Archana Sathyanarayan
asked on 23 Nov 2009, 11:36 AM
Hi
I want to search a link on the perticular part of a web page.
Say for example in the attached file I want to search an organization "aaa".
How do I do this without writing the script.
Regards
Archana
I want to search a link on the perticular part of a web page.
Say for example in the attached file I want to search an organization "aaa".
How do I do this without writing the script.
Regards
Archana
3 Answers, 1 is accepted
0
Hi Archana,
Unfortunately, there is not a function to create a search for an element without creating some action, verification, wait for test step, or creating a custom code step.
You can edit the auto-generated find params that a test step is bound to as in this video. Or you can change the element that the test step acts in the properties window.
In the latter case, you can follow these steps to change the element:
1) Click on the '...Element' property for a test step in the Properties Window
2) Then click on the '...' button to launch the 'Project Elements Selector' Window.
3) From this window, you can then select and change the element the test step will act on.
You can also switch the test step to an element you manually add to the project when you: Highlight element -> Right Click -> (Select) 'Add to Project Elements'.
If you decide to use a custom find coded step, you can use this documentation to create your search.
You can try all of the above to change the find params or the elements in your test, but usually the auto generated find for page element will work if the test sequence is recorded in a logical order.
Please let us know if you have any further question on this.
All the best,
Nelson Sin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Unfortunately, there is not a function to create a search for an element without creating some action, verification, wait for test step, or creating a custom code step.
You can edit the auto-generated find params that a test step is bound to as in this video. Or you can change the element that the test step acts in the properties window.
In the latter case, you can follow these steps to change the element:
1) Click on the '...Element' property for a test step in the Properties Window
2) Then click on the '...' button to launch the 'Project Elements Selector' Window.
3) From this window, you can then select and change the element the test step will act on.
You can also switch the test step to an element you manually add to the project when you: Highlight element -> Right Click -> (Select) 'Add to Project Elements'.
If you decide to use a custom find coded step, you can use this documentation to create your search.
You can try all of the above to change the find params or the elements in your test, but usually the auto generated find for page element will work if the test sequence is recorded in a logical order.
Please let us know if you have any further question on this.
All the best,
Nelson Sin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Archana Sathyanarayan
Top achievements
Rank 1
answered on 24 Nov 2009, 03:45 AM
Hi Nelson,
Thanks for the reply. I tried using verifying element content with Regex option. Its working fine. But I need to display custom message box if the searched element not found in the list. How do I accomplish this.
Regards
Archana
Thanks for the reply. I tried using verifying element content with Regex option. Its working fine. But I need to display custom message box if the searched element not found in the list. How do I accomplish this.
Regards
Archana
0
Hi again Archana,
I'm glad to hear you got this working. If you wanted a custom dialog message box thrown when the element is not found, then you would have to convert to code.
The following code will catch an TimeoutException when the Google search box element find params are changed in WebUI, resulting in the search box element not being found:
The Log line in the catch block will write a custom message to the Visual Studio .trx file. The MessageBox line is .Net Framework implementation and will throw a message dialog. Re-throwing exception t will fail the test as expected.
Let us know if this is what you had in mind.
Kind regards,
Nelson Sin
the Telerik team
EDIT: In the above code, if you can use 'Exception e' instead of 'System.TimeoutException t'. Sorry about that, I thought I was regularly getting that particular exception in the scenario, but it's probably safer just to use 'Exception e' and then Re-throw e.
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I'm glad to hear you got this working. If you wanted a custom dialog message box thrown when the element is not found, then you would have to convert to code.
The following code will catch an TimeoutException when the Google search box element find params are changed in WebUI, resulting in the search box element not being found:
[CodedStep(@"Set 'input_Text_Q' text to 'google'")] public void WebAiiTest1_CodedStep() { try{ // Set 'input_Text_Q' text to 'google' HtmlInputText input_Text_Q = Pages.Google.input_Text_Q; input_Text_Q.Wait.ForExists(10000); input_Text_Q.Text = "google"; } catch (System.TimeoutException t) { Log.WriteLine("CustomMessage"); MessageBox.Show(t.Message,"Error Thrown", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); throw t; } }The Log line in the catch block will write a custom message to the Visual Studio .trx file. The MessageBox line is .Net Framework implementation and will throw a message dialog. Re-throwing exception t will fail the test as expected.
Let us know if this is what you had in mind.
Kind regards,
Nelson Sin
the Telerik team
EDIT: In the above code, if you can use 'Exception e' instead of 'System.TimeoutException t'. Sorry about that, I thought I was regularly getting that particular exception in the scenario, but it's probably safer just to use 'Exception e' and then Re-throw e.
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.