Telerik Forums
Testing Framework Forum
9 answers
192 views
Hi all.

Migrating our tests from WebAii 1.1 to WebAii 2.0, I suspect a strange behavior of Manager.Browsers.Count field.

The problem is that the count of actually opened browser windows is less than Manager.Browsers.Count.
How we get into this situation: our application opens its main window, then opens a modal window (HTML page, not an alert; Manager.Browsers.Count is now 2),
then a button on the modal window is pressed, so the window closes. But Manager.Browsers.Count does not become 1, as expected.

In our tests we usually check the count of the open windows to know whether the report window was successfully closed or not, so this option is vital for us. 

Thus I wonder if it could be fixed in some way.

Best regards,
Yaroslav
Stoich
Telerik team
 answered on 21 Nov 2011
2 answers
130 views
Hi,

I'm using the Telerik Testing Framework to create an automation framework to test our Silverlight application. There are a few instances where clicking a button requires a wait for another element on the screen to become usable. I wrap the button controls like so:

public class Button
    {
        public RadButton Control;
         
        public Button() { }
 
        public Button(string automationId)
        {
            AutomationId = automationId;
            Control = Manager.Current.ActiveBrowser.SilverlightApps()[0].Find.ByAutomationId<RadButton>(automationId);
        }
 
        public string AutomationId { get; set; }
 
        public void Click()
        {
            this.Control.User.Click();
        }
....
}

In some cases, however, clicking on a particular button requires a wait for some other control. The test script should have no idea that it needs to wait for another control after clicking a particular button. So, where I'm initialising the button instance itself, I am thinking to pass in a string of a method which contains the code in order to wait for another control on the screen to become usable (or whatever other code it needs) - and will need to overload Button.

But I'm not really sure what the best way is of doing this - I've had a look at InvokeMethod, maybe that will help?

Is someone able to point me in the right direction?

Thanks :)
Plamen
Telerik team
 answered on 21 Nov 2011
1 answer
268 views
Hi,

objParent.Find.ByName("txtName").TextContent
  
Output : ""  (Empty String)

But the same

objParent.Find.ByName<TextBox>("txtName").Text
  
Output : String Value

Framework Version : "2011.1.609.0"

Thanks,
Siva
Plamen
Telerik team
 answered on 18 Nov 2011
1 answer
118 views
Hi,
I am writing a test script using MS test and Webaii in which i have to fill in a application form.On the save of the form the system checks for the mandatory feilds if not prompts a javascript alert message that the mandatory feilds a,b,c are not filled.
I need to capture and log this step in my code test
I did the floowing to try capture the script alert

           Settings.Current.UnexpectedDialogAction = UnexpectedDialogAction.HandleAndFailTest;
           manager.DialogMonitor.Start();
// Attempted to check if the line below captures the dialog
           int counter= manager.DialogMonitor.Dialogs.Count;
//This actually adds a dialog --- not what is needed

            manager.DialogMonitor.AddDialog(new AlertDialog(manager.ActiveBrowser,DialogButton.OK));


Any help appreciated

Stoich
Telerik team
 answered on 18 Nov 2011
0 answers
92 views
Please ignore
Saket
Top achievements
Rank 1
 asked on 17 Nov 2011
1 answer
113 views

I have the DOM for a button in the below fashion

<input name="TestButton" class="action-button" id="TestButton" role="button"  type="submit" jQuery15109470652432947769="3" value="Test"/>

Im getting the HTMLInputSubmit control by Findexpression (id="TestButton")

If i perform Click Action it is not working.

Tried HTMLInputSubmit.MouseClick and it works in my local machine

And in my test run, which triggers this in remote machines, this fails to perform MouseClick action.

also tried InvokeScript(JqueryScripts.ClickbyID() with script event type set to OnClick - Not Working

Anybody can shed some light on this ??

Anthony
Telerik team
 answered on 16 Nov 2011
5 answers
138 views
Hi,

I am using Webaii with VS2010 test suite, wanted to know can i some how have the record and play action implemented in code ?


Thanks,
Saket
Cody
Telerik team
 answered on 15 Nov 2011
3 answers
112 views
hi, my problem is I need take the content of cell <td> for the Price1 and Price2, and this doesn't work

(Pages.HTMLTables.Table.Find.AllByExpression<HtmlTableCell>("tagname=td")[0].TextContent);

<TABLE class=Table ><THEAD>
<TR>
<TD class=first-child width=150> Name</TD>
<TD width=100>Cruise Rate</TD>
<TD width=135>
<DIV class=table-align>Government <BR>Fees &amp; Taxes <SPAN class="tooltip 3></A> </SPAN></DIV></TD>
<TD width=136>Vacation <BR>Protection <A class="thickbox learn-more" >Learn More</A> </TD>
<TD class=last-child width=116>Total</TD></TR></THEAD>
<TBODY>
<TR class=first-child>
<TD class=first-child><STRONG>Price1</STRONG></TD>
<TD>$289.00</TD>
<TD>$62.59</TD>
<TD class=td-vpp><A class="remove addRemoveVPLink" href="#" rate="$49.00">Remove $49.00</A>
 <INPUT type=hidden name=addVPSeqNumbers TeaLeaf="true"> </TD>
<TD class=last-child align=right><STRONG>$400.59</STRONG></TD></TR>
<TR>
<TD class=first-child><STRONG> Price2</STRONG></TD>
<TD>$289.00</TD>
<TD>$62.59</TD>
<TD class=td-vpp><A class="remove addRemoveVPLink" href="#" rate="$49.00" >Remove $49.00</A> <INPUT type=hidden name=addVPSeqNumbers TeaLeaf="true"> </TD>
<TD class=last-child align=right><STRONG>$400.59</STRONG></TD></TR>
Anthony
Telerik team
 answered on 15 Nov 2011
23 answers
373 views
Hi guys,

I’m getting “Wait for condition has timed out” exceptions when calling LaunchNewBrowser. The strange thing is that this problem doesn't happen all the time (except in one case, see below).

Stacktrace:
   at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo)
   at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
   at ArtOfTest.WebAii.Core.Manager.WaitForBrowserToConnect(Int32 browserIndexToWaitFor)
   at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle, String arguments)
   at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect)

Things to note about our setup:

1.    We are using Telerik Testing Framework 2011.1 (2011.1.609). However, this problem also happened when we were running version 2010.1.

2.    On most of our servers (a mix of Server 2003, 2008, 32 bit, 64 bit, IE8, IE9) we’re getting this message regularly, but not all the time. Roughly, 80% of the time there is no problem, 20% is showing this exception (or similar problems). Usually, it helps to just retry calling .LaunchNewBrowser, but not always.

3.    When this happens, a new browser is started and visible without any delays, but Telerik Testing Framework is not able to connect to it (see below).

4.    As of today, we have one new Server 2003 which always displays this behavior. This server has never had an earlier version of Telerik Testing Framework, but when I install the version we used previously (2010.1), we’re seeing normal behavior (80% OK, 20% error).

5.    I’m including a snippet of our application’s trace log.

Framework: InternetExplorerActions.LaunchNewBrowserInstance() : Process launched (ID=5460, Path="\Device\HarddiskVolume1\Program Files\Internet Explorer\IEXPLORE.EXE", Arguments="-nomerge about:blank").
Framework: InternetExplorerActions.LaunchNewBrowserInstance() : Attempting to attach on IE frame (HWND=197334)...
Framework: InternetExplorerActions.LaunchNewBrowserInstance() : Process "URLTester" (ID=2728) is assumed to host the controller.
Uncategorized: Connector.InjectCode() : ------- Function Start 'Connector.InjectCode' -------
Uncategorized: Connector.InjectCode() : Connection string: C:\WINDOWS\assembly\GAC_MSIL\ArtOfTest.InternetExplorer\2011.1.609.0__5339893a7cefe4d6\ArtOfTest.InternetExplorer.dll?ArtOfTest.InternetExplorer.ArtOfTestPluginEntryPoint?2728
Framework: InternetExplorerActions.WaitForDocument() : Attempting to get IHTMLDocument2 from Internet Explorer HWND 197334 on another thread...
Uncategorized: <>c__DisplayClasse.<WaitForDocument>b__7() : Attempting to get document from window handle
Framework: InternetExplorerActions.WaitForDocument() : IHTMLDocument2 successfully retrieved.
Framework: Connector.InjectCode() : Sending WM_COPYDATA to HWND 197334 (lpData = "C:\WINDOWS\assembly\GAC_MSIL\ArtOfTest.InternetExplorer\2011.1.609.0__5339893a7cefe4d6\ArtOfTest.InternetExplorer.dll?ArtOfTest.InternetExplorer.ArtOfTestPluginEntryPoint?2728")...
Framework: Connector.InjectCode() : Returned from sending WM_COPYDATA (LRESULT=0, GetLastError()=DS_S_SUCCESS).
Uncategorized: Connector.InjectCode() : ------- Function End 'Connector.InjectCode' -------
<The exception occurs after this point>

6.    If I compare this with the log of regular (correct) cases, I'm missing this part:

Framework: BrowserProvisioner.ServiceThread() : A new client has connected to the provisioning pipe.
Framework: BrowserRemoted.AsyncListenerThreadEntry() : Not connected; this will now wait indefinitely for a pipe client connection...
Framework: BrowserRemoted.AsyncListenerThreadEntry() : A new client has connected to the pipe.
Framework: BrowserRemoted.AsyncListenerThreadEntry() : Now waiting indefinitely for a command from the pipe client...
Framework: Manager.AddNewBrowser() : Added client ID "Client_81b0ef79-6ece-4f38-97e1-1332561eab77" (now there is/are 1 total).
Framework: Connector.InjectCode() : Returned from sending WM_COPYDATA (LRESULT=0, GetLastError()=DS_S_SUCCESS).
Uncategorized: Connector.InjectCode() : ------- Function End 'Connector.InjectCode' -------

7. Therefore, either the client is not connecting through the pipe, or BrowserProvisioner.ServiceThread() isn't running. I looked at the internal ArtOfTest.WebAii code using JustDecompile, in order to try and understand what is happening, but I haven't been able to figure out which code is calling BrowserProvisioner.ServiceThread.

8. I have tried disabling the Named Pipes restriction in Local Security Policies, but this doesn't seem to make any difference, and it wouldn't explain why the problem occurs *some* of the time.

9. Obviously, our servers and browsers are configured as per Telerik's documentation.


Apologies for this long message. We would really like to get some more control over this problem, as it would greatly improve the stability of our software. Please let us know if you need more information. Thanks very much in advance.

Kind regards,
JP
Peter
Top achievements
Rank 1
 answered on 13 Nov 2011
7 answers
380 views
I need to iterate over the rows of a Silverlight RadGridView checking for duplicates and the total count.  I adapted the sample from http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/code-samples/silverlight/radgridview/scrolling.aspx.  I test against the telerik sample page here: http://demos.telerik.com/silverlight/#GridView/PagingLargeData.

I expect to get a row count on the first page of 100 and examine each row once.  Instead, I get a row count of ~120 (it changes between runs) and several rows seem to appear twice and/or out of order.  For example, the last row I print out is "83, Maxilaku, $45.60, 5/12/2008, ". How can I accomplish my goal of examining each and every row of the current RadGridView page in the order they appear in the grid and once and only once?

I am using Test Framework 2011.2.928.0 and Silverlight 4.0.60831.0.

My code follows.
Thanks,
Ken
[Test]
public void SampleWebAiiTest()
{
    Settings.Current.Web.EnableSilverlight = true;
 
    // Launch a browser instance
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
 
    // The active browser
    ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#GridView/PagingLargeData");
 
    SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
 
    int verticalOffset = 0; // Holds the current vertical offset in the viewport
    int viewPortHeight; // The height of the visible part of the grid
    int extentHeight; // The total height of the grid, visible plus non-visible
 
    // Copy the RadGridView into a local variable as a shortcut
    RadGridView grid = app.Find.ByAutomationId<RadGridView>("GridView");
 
    // Grab the VirtualizingPanel contained in the RadGridView. This is used to control the viewable portion of the grid.
    FrameworkElement virtualizingPanel = grid.Find.ByType("GridViewVirtualizingPanel");
 
    // Detect the view port height and the extent height
    viewPortHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ViewportHeight", typeof(int)));
    extentHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ExtentHeight", typeof(int)));
 
    // Make sure it is scrolled to the very top
    // Walk through the entire grid verifying the data
    virtualizingPanel.InvokeMethod("SetVerticalOffset", 0);
 
    int index;
    int totalCount = 0;
    string rowText;
    while (verticalOffset < extentHeight)
    {
        foreach (GridViewRow r in grid.Rows)
        {
            totalCount++;
            index = r.Index;
            rowText = string.Join(", ", r.Cells.Select(item => item.Text));
        }
        // Scroll down one page
        verticalOffset += viewPortHeight;
        virtualizingPanel.InvokeMethod("SetVerticalOffset", verticalOffset);
    }
}
Cody
Telerik team
 answered on 12 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?