Hi!
In our webapplication we have a jquery search field in which letters are entered, and a list of peoples names are listed that contains the letters entered. I.e. if I enter "w" a list of people having "w" within one of their names are listed.
The list is not appearing when I replay the test, though. I have read the documentation on jquery controllers both on Teleriks help pages, and in this forum, but it is not helping me out.
This is the method that should "trigger" the list:
Actions.SetText(Pages.BestillAvbestillRollerFor0.TxtSokSearch, "w")
Does anyone have any suggestions on how to make it work?
In our webapplication we have a jquery search field in which letters are entered, and a list of peoples names are listed that contains the letters entered. I.e. if I enter "w" a list of people having "w" within one of their names are listed.
The list is not appearing when I replay the test, though. I have read the documentation on jquery controllers both on Teleriks help pages, and in this forum, but it is not helping me out.
This is the method that should "trigger" the list:
Actions.SetText(Pages.BestillAvbestillRollerFor0.TxtSokSearch, "w")
Does anyone have any suggestions on how to make it work?
16 Answers, 1 is accepted
0
Miguel
Top achievements
Rank 1
answered on 02 Sep 2014, 02:04 PM
Hi Tonje,
For jQuery events you have to trigger the event from your code. I've found it that most of the time when you record the test Test Studio will automatically do this for you but in case you haven't got it to record it properly it should look something like this:
// Invoke jQuery 'select' event'
ArtOfTest.WebAii.jQuery.jQueryControl jQueryControl = Pages.BestillAvbestillRollerFor0.TxtSokSearch.AsjQueryControl();
jQueryControl.InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change);
System.Threading.Thread.Sleep(200);
For jQuery events you have to trigger the event from your code. I've found it that most of the time when you record the test Test Studio will automatically do this for you but in case you haven't got it to record it properly it should look something like this:
// Invoke jQuery 'select' event'
ArtOfTest.WebAii.jQuery.jQueryControl jQueryControl = Pages.BestillAvbestillRollerFor0.TxtSokSearch.AsjQueryControl();
jQueryControl.InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change);
System.Threading.Thread.Sleep(200);
0
Tonje
Top achievements
Rank 1
answered on 03 Sep 2014, 09:35 AM
Well, I'm sorry to say, but this didn't solve my problem..
0
Hi,
@Miguel, Thank you for you input. We really appreciate it.
@Tonje, the problem which is causing the problem is that some jQuery event is not triggered.
You have two options here:
1. Trigger manually the right event as Miguel suggested.
2. Create two test steps. The first one should click in the search field and then create the second step which will type the text as a real user (this should trigger the necessary event):
Let me know if this helps.
Regards,
Boyan Boev
Telerik
@Miguel, Thank you for you input. We really appreciate it.
@Tonje, the problem which is causing the problem is that some jQuery event is not triggered.
You have two options here:
1. Trigger manually the right event as Miguel suggested.
2. Create two test steps. The first one should click in the search field and then create the second step which will type the text as a real user (this should trigger the necessary event):
Manager.Desktop.KeyBoard.TypeText(
"searchText"
);
Let me know if this helps.
Regards,
Boyan Boev
Telerik
0
Tonje
Top achievements
Rank 1
answered on 08 Sep 2014, 09:39 AM
Ok. I got this to work. But not exactly the way you described it.
I created two test steps.
1) Clicking in the search field
2) Writing "w" in the search field.
I then modified the clicking step to look like this:
'Pages.BestillAvbestillRollerFor0.TxtSokSearch.Click(false)
dim jQueryControl1 as ArtOfTest.WebAii.jQuery.jQueryControl
jQueryControl1 = Pages.BestillAvbestillRollerFor0.TxtSokSearch.AsjQueryControl()
jQueryControl1.InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change)
System.Threading.Thread.Sleep(200)
! Note that I had to comment out the click action !
Secondly I left the test step for writing in "w" the way it was recorded. If I changed it to:
Manager.Desktop.KeyBoard.TypeText("w") nothing happened.
Instead this is working:
Actions.SetText(Pages.BestillAvbestillRollerFor0.TxtSokSearch, "w")
I created two test steps.
1) Clicking in the search field
2) Writing "w" in the search field.
I then modified the clicking step to look like this:
'Pages.BestillAvbestillRollerFor0.TxtSokSearch.Click(false)
dim jQueryControl1 as ArtOfTest.WebAii.jQuery.jQueryControl
jQueryControl1 = Pages.BestillAvbestillRollerFor0.TxtSokSearch.AsjQueryControl()
jQueryControl1.InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change)
System.Threading.Thread.Sleep(200)
! Note that I had to comment out the click action !
Secondly I left the test step for writing in "w" the way it was recorded. If I changed it to:
Manager.Desktop.KeyBoard.TypeText("w") nothing happened.
Instead this is working:
Actions.SetText(Pages.BestillAvbestillRollerFor0.TxtSokSearch, "w")
0
Tonje
Top achievements
Rank 1
answered on 08 Sep 2014, 09:55 AM
No, I take it back.
It is just like before. Working only sometimes, and most of the time not working.
It is just like before. Working only sometimes, and most of the time not working.
0
Hello Tonje,
Please let me interject into this ticket since Boyan is out of the office.
You can play around with the suggestion that Miguel provided, since it may be some different event than the change event, it may be keypress, keydown, focus event etc.
Without having access to the search field in question we can only guess on how to automate this. If you can provide access to the tested application that would be tremendous help.
Thank you for your understanding and cooperation in advance.
Regards,
Ivaylo
Telerik
Please let me interject into this ticket since Boyan is out of the office.
You can play around with the suggestion that Miguel provided, since it may be some different event than the change event, it may be keypress, keydown, focus event etc.
Without having access to the search field in question we can only guess on how to automate this. If you can provide access to the tested application that would be tremendous help.
Thank you for your understanding and cooperation in advance.
Regards,
Ivaylo
Telerik
0
Jerne
Top achievements
Rank 2
answered on 11 Sep 2014, 09:03 AM
This is the code Test Studio generates when using "simulate real typing" which often solves problems with tests for me:
This is recorded and tested on a sample site:
ActiveBrowser.Window.SetFocus();
Pages.Google.GbqfqText.Focus();
Pages.Google.GbqfqText.MouseClick();
Manager.Desktop.KeyBoard.TypeText("type", 50, 100, true);
This is recorded and tested on a sample site:
ActiveBrowser.Window.SetFocus();
Pages.Google.GbqfqText.Focus();
Pages.Google.GbqfqText.MouseClick();
Manager.Desktop.KeyBoard.TypeText("type", 50, 100, true);
0
Tonje
Top achievements
Rank 1
answered on 12 Sep 2014, 09:33 AM
Hm.. this is rather odd.
Because no matter what I change the code into, based on all of the advices I have got, it is only working the first time I run the script. So I've got a feeling that the solution lies elsewhere?
Regards,
Tonje
Because no matter what I change the code into, based on all of the advices I have got, it is only working the first time I run the script. So I've got a feeling that the solution lies elsewhere?
Regards,
Tonje
0
Hеllo Tonje,
It would be nice if you provide us with the failure message so we can take a look.
Also as I stated in my previous response, it will be extremely helpful if we have access to the application so we can take a look. As you see we are only guessing here, which is not quite helpful at this point.
Thank you for your cooperation in advance.
Regards,
Ivaylo
Telerik
It would be nice if you provide us with the failure message so we can take a look.
Also as I stated in my previous response, it will be extremely helpful if we have access to the application so we can take a look. As you see we are only guessing here, which is not quite helpful at this point.
Thank you for your cooperation in advance.
Regards,
Ivaylo
Telerik
0
Tonje
Top achievements
Rank 1
answered on 16 Sep 2014, 08:11 AM
Hi,
I am sorry, but I can not give access to the application, as it contains sensitive information.
This is the test log:
Overall Result: Fail
------------------------------------------------------------
'16.09.2014 10:03:57' - Executing test: 'RolleBestilling', path: 'RolleBestilling.tstest.'
'16.09.2014 10:03:57' - Using .Net Runtime version: '4.0.30319.18444' for test execution. Build version is '2014.2.618.0'.
'16.09.2014 10:03:57' - Starting execution....
'16.09.2014 10:04:00' - Detected custom code in test. Locating test assembly: TestProject1.dll.
'16.09.2014 10:04:00' - Assembly Found: C:\Test Studio\TestProject1\bin\TestProject1.dll
'16.09.2014 10:04:00' - Loading code class: 'TestProject1.RolleBestilling'.
------------------------------------------------------------
------------------------------------------------------------
'16.09.2014 10:04:00' - Using 'InternetExplorer' version '11.0' as default browser.
'16.09.2014 10:04:00' - 'Pass' : 1. Navigate to : 'xxx'
'16.09.2014 10:04:00' - 'Pass' : 2. Enter text 'xxx' in 'UsernameText'
'16.09.2014 10:04:01' - 'Pass' : 3. Keyboard (KeyPress) - Skift+E (1 times) on 'PwordPassword'
'16.09.2014 10:04:01' - 'Pass' : 4. Enter text 'xxx' in 'PwordPassword'
'16.09.2014 10:04:01' - 'Pass' : 5. Click 'Submit'
'16.09.2014 10:04:02' - 'Pass' : 6. Click 'RollebestillingLink'
'16.09.2014 10:04:02' - 'Pass' : 7. Enter text 'kov' in 'LoginSignatureText'
'16.09.2014 10:04:03' - 'Pass' : 8. Click 'Submit'
'16.09.2014 10:04:03' - 'Pass' : 9. [RolleBestilling_CodedStep1] : Click 'TxtSokSearch'
'16.09.2014 10:04:03' - 'Pass' : 10. [RolleBestilling_CodedStep] : Enter text 'w' in 'TxtSokSearch'
'16.09.2014 10:04:33' - 'Fail' : 11. Click 'UiId2Link'
------------------------------------------------------------
Failure Information:
~~~~~~~~~~~~~~~
Unable to locate element. Details: Attempting to find [Html] element using
Find logic
(Html): [id 'Exact' ui-id-2] AND [tagname 'Exact' a]
Unable to locate element. Search failed!
Learn more about finding elements here:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/troubleshooting_guide/test-execution-problems/unable-to-locate-element.aspx
------------------------------------------------------------
'16.09.2014 10:04:33' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.
------------------------------------------------------------
'16.09.2014 10:04:33' - Overall Result: Fail
'16.09.2014 10:04:33' - Duration: [0 min: 33 sec: 772 msec]
------------------------------------------------------------
'16.09.2014 10:04:38' - Test completed!
I am sorry, but I can not give access to the application, as it contains sensitive information.
This is the test log:
Overall Result: Fail
------------------------------------------------------------
'16.09.2014 10:03:57' - Executing test: 'RolleBestilling', path: 'RolleBestilling.tstest.'
'16.09.2014 10:03:57' - Using .Net Runtime version: '4.0.30319.18444' for test execution. Build version is '2014.2.618.0'.
'16.09.2014 10:03:57' - Starting execution....
'16.09.2014 10:04:00' - Detected custom code in test. Locating test assembly: TestProject1.dll.
'16.09.2014 10:04:00' - Assembly Found: C:\Test Studio\TestProject1\bin\TestProject1.dll
'16.09.2014 10:04:00' - Loading code class: 'TestProject1.RolleBestilling'.
------------------------------------------------------------
------------------------------------------------------------
'16.09.2014 10:04:00' - Using 'InternetExplorer' version '11.0' as default browser.
'16.09.2014 10:04:00' - 'Pass' : 1. Navigate to : 'xxx'
'16.09.2014 10:04:00' - 'Pass' : 2. Enter text 'xxx' in 'UsernameText'
'16.09.2014 10:04:01' - 'Pass' : 3. Keyboard (KeyPress) - Skift+E (1 times) on 'PwordPassword'
'16.09.2014 10:04:01' - 'Pass' : 4. Enter text 'xxx' in 'PwordPassword'
'16.09.2014 10:04:01' - 'Pass' : 5. Click 'Submit'
'16.09.2014 10:04:02' - 'Pass' : 6. Click 'RollebestillingLink'
'16.09.2014 10:04:02' - 'Pass' : 7. Enter text 'kov' in 'LoginSignatureText'
'16.09.2014 10:04:03' - 'Pass' : 8. Click 'Submit'
'16.09.2014 10:04:03' - 'Pass' : 9. [RolleBestilling_CodedStep1] : Click 'TxtSokSearch'
'16.09.2014 10:04:03' - 'Pass' : 10. [RolleBestilling_CodedStep] : Enter text 'w' in 'TxtSokSearch'
'16.09.2014 10:04:33' - 'Fail' : 11. Click 'UiId2Link'
------------------------------------------------------------
Failure Information:
~~~~~~~~~~~~~~~
Unable to locate element. Details: Attempting to find [Html] element using
Find logic
(Html): [id 'Exact' ui-id-2] AND [tagname 'Exact' a]
Unable to locate element. Search failed!
Learn more about finding elements here:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/troubleshooting_guide/test-execution-problems/unable-to-locate-element.aspx
------------------------------------------------------------
'16.09.2014 10:04:33' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.
------------------------------------------------------------
'16.09.2014 10:04:33' - Overall Result: Fail
'16.09.2014 10:04:33' - Duration: [0 min: 33 sec: 772 msec]
------------------------------------------------------------
'16.09.2014 10:04:38' - Test completed!
0
Hi Tonje,
What happens when you type "w" into the search box? Does the autocomplete appear? If not after clicking the search button you should use SimulateRealTyping or Manager.Desktop.KeyBoard.TypeText("w"); The field should be on focus before typing.
If the autocomplete appears and only the click step fails there is something wrong with the find expression. Is that ID unique and static (always the same)?
A video of the test running may help us diagnose the problem as well. Jing is a good free screen recorder for up to 5 minutes of video.
The fastest and easiest way to resolve this is to grant us a direct access to your application, so we can replicate the issue and give you a solution.
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
What happens when you type "w" into the search box? Does the autocomplete appear? If not after clicking the search button you should use SimulateRealTyping or Manager.Desktop.KeyBoard.TypeText("w"); The field should be on focus before typing.
If the autocomplete appears and only the click step fails there is something wrong with the find expression. Is that ID unique and static (always the same)?
A video of the test running may help us diagnose the problem as well. Jing is a good free screen recorder for up to 5 minutes of video.
The fastest and easiest way to resolve this is to grant us a direct access to your application, so we can replicate the issue and give you a solution.
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
0
Tonje
Top achievements
Rank 1
answered on 19 Sep 2014, 06:35 AM
Thanks for the tip regarding video recording. I haven't thought of that previously..
The jquery UI autocomplete should appear immediately when entering text into the search field. There is no button.
The jquery UI autocomplete should appear immediately when entering text into the search field. There is no button.
0
Tonje
Top achievements
Rank 1
answered on 19 Sep 2014, 07:43 AM
The elements on the pages are identified by static IDs.
0
Tonje
Top achievements
Rank 1
answered on 19 Sep 2014, 09:03 AM
I have checked that my browser configurations are correct. I also recorded the test over again, ticked off "SimulateRealTyping" and "UseStepWaitOnElements", and didn't add any coding. And it behaves exactly the same way: Sometimes it is able to play it correctly, and sometimes not. Most of the time it is working the first time I run the test against a certain browser (for example ie). But if I run it again towards the same browser, it won't populate the Jquery UI AUtocomplete list.
There is something fishy going on.. The test steps can't be wrong when they work sometimes but other times not?
There is something fishy going on.. The test steps can't be wrong when they work sometimes but other times not?
0
Tonje
Top achievements
Rank 1
answered on 19 Sep 2014, 09:14 AM
Here is a recording of the running twice - first time it plays correctly, second not. I can't display the entire page of the application as it contains sensitive information.
0
Hello Tonje,
Thank you for the videos. Now I can understand the problem. The issue is that during the second execution Test Studio is not typing 'w'.
It seems that the page is loading too quickly. Please add 3 seconds execution delay before the step which is typing 'w' and give it a try.
Let me know the results.
Regards,
Boyan Boev
Telerik
Thank you for the videos. Now I can understand the problem. The issue is that during the second execution Test Studio is not typing 'w'.
It seems that the page is loading too quickly. Please add 3 seconds execution delay before the step which is typing 'w' and give it a try.
Let me know the results.
Regards,
Boyan Boev
Telerik