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

How to debug the code that is generated for a recording?

3 Answers 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jinesh Kurian
Top achievements
Rank 1
Jinesh Kurian asked on 17 May 2010, 03:50 PM
I've recorded a scenario and when i try to play it, it fails somewhere. I need to find the reason for the failure. I added a break point to locate the problem, but I ran into another problem. The lines which contain "ActiveBrowser" all seem to type the data in Visual Studio itself. It wasnt typing the text in the textbox in the browser as desired.

Is there any way to do this?

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 17 May 2010, 06:04 PM
Hi Jinesh Kurian,

It sounds like you're dealing with a test that is using "simulate real typeing". In order for the keystrokes to be typed into the correct window, there's a SetFocus call just before the typing to force input focus to the right window like this:

// Set 'TxtEmailText' text to 'cgibson@artoftest.com'
Pages.TelerikAdminConsole.TxtEmailText.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop);
ActiveBrowser.Window.SetFocus();
Pages.TelerikAdminConsole.TxtEmailText.MouseClick();
Manager.Desktop.KeyBoard.TypeText("mail@mail.com", 150);

You can set a breakpoint on the SetFocus call or after the TypeText call. If you try to set a breakpoint on the MouseClick or the TypeText line you'll get the problem you describe. Outside of following this guideline you should be able to set your breakpoint anywhere you like.

If that doesn't help can you post the test/code you're trying to debug? Once we see your code we'll be better able to assist in debugging it.

BTW, this was posted in QA Edition forum... but it sounds like you're using the Developer edition?

Greetings,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jinesh Kurian
Top achievements
Rank 1
answered on 18 May 2010, 06:13 AM
Dear Cody,

Please find the sample piece of code that I'm using in my test. I dont think I can use the focus as you suggested. there wont be any problem for me to add, but it simply adds to the lines of code. If there could be any other thing to do, please let me know.

_Pages.AccountScreen.SilverlightApp.PARTEditableTextBoxPickertextbox.Text = ""
            _Pages.AccountScreen.SilverlightApp.PARTEditableTextBoxPickertextbox.User.TypeText("A MGR", 10); 
            _ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString("Enter"), 150, 1); 
            System.Threading.Thread.Sleep(5000); 
            _ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString("Tab"), 150, 2); 
            _ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString("Ctrl+A"), 150, 1); 
            _Pages.AccountScreen.SilverlightApp.PARTEditableTextBoxPickertextbox.User.TypeText("Request Manager Review", 10); 

0
Cody
Telerik team
answered on 18 May 2010, 04:47 PM
Hello Jinesh Kurian,

No, I'm sorry there is no other solution. As soon as the VS debugger hits the breakpoint, Windows deliberately takes the focus away from the browser window and gives it to VS so you can interact with the VS GUI. Before any typing can happen in the browser window again, focus must be returned to the browser window somehow. If it were me, I'd add SetFocus calls temporarily for debugging and remove them when I'm finished working on the test.

Best wishes,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Jinesh Kurian
Top achievements
Rank 1
Answers by
Cody
Telerik team
Jinesh Kurian
Top achievements
Rank 1
Share this question
or