Telerik Forums
Testing Framework Forum
1 answer
114 views
Hello,

I am trying to following the tutorial in the documentation: http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/html/dynamic-grid.aspx

1. I first navigate to the site http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
2. Then I add GridTableView to project element
3. I added a code step with the code:

foreach (HtmlTableRow r in Pages.ClientSideRowSelection.TemporaryRadGridTable1)
            {
                foreach(HtmlTableCell c in r.Cells)
                {
                    Log.WriteLine("Cell found. TextContent:"+c.TextContent);
                }
            }

Then when I run the test, I get an error in the log saying: "......DynamicGridTest.tstest.cs: Line 78: (CS1579) foreach statement cannot operate on variables of type 'Telerik.WebAii.Controls.Html.GridTableView' because 'Telerik.WebAii.Controls.Html.GridTableView' does not contain a public definition for 'GetEnumerator'"

How do I solve this problem?

Thanks



-------------------------------------

never mind, solved.
Mario
Telerik team
 answered on 24 May 2013
9 answers
562 views
Hi,

I´ve got a big problem by getting the inner text of an element. I spent a whole day in trying and letting this in theory simple thing drive me crazy..

<span id="messageText">That´s the text i want to get...</span>

I want to assert this text but always get an empty string. This is my current code:
var frame = browser.WaitForElement(new HtmlFindExpression("id=rightIFrame"), 10000, false);
var span = frame.Find.ByExpression<HtmlSpan>(
"id=rightIFrame");
span.Wait.ForExists();
Assert.AreEqual(
"That´s the text i want to get...", span.TextContent);

Result:
Expected string length x but was 0. Strings differ at index 0.
  Expected: "That´s the text i want to get.."
  But was:  <string.Empty>
  -----------^

I also tried InnerText but it doesn´t change anything, now I just don´t know what to do and hope you can help me.

(Edit: I also already tried Thread.Sleep(), even though it surely hadn´t been a clean and good solution, just to see if the text maybe hasn´t loaded yet, but not even that did change anything..)

Thanks
Kind regards

Boyan Boev
Telerik team
 answered on 21 May 2013
3 answers
71 views
Hello,

I would like to capture events through the Teleric testing framework. I want my application to be notified whenever a user clicks on a button, changes text in a control, etc on a webpage with a Silverlight control.  When the framework notifies my application, I want my application to capture the control properties. Can you help me with some sample code which does that ? 

Thanks
Plamen
Telerik team
 answered on 20 May 2013
1 answer
73 views
the responsehandler is called with the first row in the spreadsheet but with subsequent rows the responsehandler is not called.

 Settings testSettings = new Settings();  
            testSettings.Web.UseHttpProxy = true;       
            Manager mgr = new Manager(testSettings);
            try
            {             
                mgr.Start();               
                ResponseListenerInfo li = new ResponseListenerInfo(ResponseHandler);
                Debug.WriteLine("instantiated listener");
                mgr.Http.AddBeforeResponseListener(li);
                Debug.WriteLine("added listener");
                mgr.LaunchNewBrowser(BrowserType.InternetExplorer, true);
                url = string.Format("http://{0}{1}", domain, Data["url"]);
                mgr.ActiveBrowser.NavigateTo(url);
                
                mgr.ActiveBrowser.WaitUntilReady();
                mgr.Http.RemoveBeforeResponseListener(li);
                // System.Threading.Thread.Sleep(3000);
                mgr.ActiveBrowser.Close();
                // li=null;               
            }
            catch(Exception e){
                Debug.WriteLine(string.Format("error {0}",e.Message));   
            }
            finally
            {                   
               mgr=null;
               Debug.WriteLine("finally");
                System.Threading.Thread.Sleep(5000);
            }
        }
        
        private void ResponseHandler(object sender, HttpResponseEventArgs e)
        {            
            Debug.WriteLine(string.Format("{0} - {1}", e.Response.Request.RequestUri,e.Response.StatusCode));
            int[] codes=new int[]{301,302,303,304,305,306,307};
            if (codes.Contains<int>(e.Response.StatusCode)){
               
               Assert.IsTrue(false);
                
            }
            System.Collections.Specialized.NameValueCollection headers = e.Response.Headers;
            if (url == e.Response.Request.RequestUri )
            {
            
                //some are reported as soft but they are real pages.
                if (e.Response.StatusCode != 200)
                {                 
                    Assert.IsTrue(ArtOfTest.Common.CompareUtils.StringCompare(e.Response.StatusCode.ToString(), "404",
                                                                              FindCompareType.Exact));
                }
            }
        }
Plamen
Telerik team
 answered on 18 May 2013
7 answers
143 views
Hi there,

I'm new to WebAii, but I was able to get some level of Silverlight automation up and running. Now, however, it appears I've hit an obstacle.

I've attached a picture of the subset of elements I'm working with. I can get a reference to the DashboardPanel element shown at the top of the image, and I can traverse the children up to the Canvas element. When debugging in Visual Studio, however, Canvas shows as having no children whatsoever. I've tried several different tactics for getting the element, but I'm confident none will work as long as Canvas supposedly has no children. Code below. Thoughts?

// Initialize the settings
Settings mySettings = new Settings();
Manager mgr = null;
SilverlightApp app = null;
 
try
{
    mySettings.Web.EnableSilverlight = true;
    mySettings.Web.DefaultBrowser = BrowserType.Chrome;
     
    // Create the manager object
    mgr = new Manager(mySettings);
 
    // Start the manager
    mgr.Start();
 
    // Launch a browser instance and navigate to the page
    mgr.LaunchNewBrowser();
    mgr.ActiveBrowser.NavigateTo("http://<;url>/");
 
    // Initialize the Silverlight app
    app = mgr.ActiveBrowser.SilverlightApps()[0];
 
    // Log into Jovix
    app.Find.WaitOnElementsTimeout = 20000;
    app.FindName<TextBox>("txtUsername").Text = "<username>";
    app.FindName<PasswordBox>("txtPassword").SetPassword(true, "<password>", 0, 0);
    app.FindName<Button>("btnLogin").User.Click();
 
    // Get the navigation tree control
    TreeView navTree = app.FindName<TreeView>("TreeView");
 
    // Navigate to Custom Fields tree view item
    navTree.Find.WaitOnElementsTimeout = 20000;
    navTree.Find.ByTextContent("Materials").Parent<TreeViewItem>()
        .Find.ByType<ItemsPresenter>()
        .Find.ByName<ToggleButton>("ExpanderButton").User.Click();
 
    navTree.Find.ByTextContent("Custom Fields").User.Click();
 
    // Try to click Add button on the toolbar
    FrameworkElement dpMain = app.Find.ByExpression(
        new XamlFindExpression("Name=dpMain")); // this works
 
    FrameworkElement dragDockPanelHost = dpMain.Find.ByExpression(
        new XamlFindExpression("XamlTag=DragDockPanelHost")); // this works
 
    FrameworkElement widget = dragDockPanelHost.Find.ByExpression(
        new XamlFindExpression("XamlTag=WidgetBase")); // this returns null

Thanks in advance!
Geoffrey
Cody
Telerik team
 answered on 17 May 2013
5 answers
153 views
I've been trying to install the testing framework repeatedly and it always hangs at "Updating Visual Studio 2012 Templates" and will just sit there for hours with no error or change of status.

Anyone experience anything like this?  I'm on Windows 8 64bit. 
Rodney
Telerik team
 answered on 15 May 2013
3 answers
150 views
Hi,
  I've got a problem running the latest version of telerik test framework and chrome. I'm trying to get the text in a popup dialog in a javascript app. I've confirmed that when running the app in the following link (with slight modifications) it doesn't work.

http://www.telerik.com/automated-testing-tools/community/forums/test-studio-express/automation-framework/confirm-and-alert-dialogs-issue-in-firefox.aspx

Modification:

            ConfirmDialog confirmDialog = ConfirmDialog.CreateConfirmDialog(ActiveBrowser, DialogButton.OK);
            confirmDialog.HandlerDelegate = new DialogHandlerDelegate(dialog =>
                                                                          {
                                                                              var captionWorks = dialog.Window.Caption;
                                                                              var THIS_RETURNS_ZERO = dialog.Window.AllChildren.Count;
                                                                          });
            Manager.DialogMonitor.AddDialog(confirmDialog);
            Manager.DialogMonitor.Start();


Can you confirm and advise on a workaround/when a fix might be expected?
  Thanks,
    John
Boyan Boev
Telerik team
 answered on 13 May 2013
19 answers
427 views
Hi,

Im trying to assert that a link (you must klick on a image) works. The link opens a new tab and I thought the best assertion for this link is just finding smth in this new window(browser) and close it after..
After openeing the link in a new tab or window im getting following exception:

System.OperationCanceledException : Exception occured waiting for the new browser to connect.
  ----> System.TimeoutException : Wait for condition has timed out
with following code

/// <summary>
/// Tests if clicking the Jira-image opens Jira
/// </summary>
[Test]
public void JiraImgOpensJira()
{      
    Manager.SetNewBrowserTracking(true);
    frame.Find.ById<HtmlImage>("Jira").MouseClick();
 
    Manager.WaitForNewBrowserConnect("https://someLink.de", true, 2000); //EXCEPTION IS AT THIS LINE
    Manager.SetNewBrowserTracking(false);                     
 
    //Assert Jira opened                
    Assert.IsTrue(ActiveBrowser.ContainsText("JiraLogin"));
    ActiveBrowser.Close();          
 
}

first i thought the problem might be the "https" but this code also doesnt work:
(TimeoutException)

[Test]
public void SampleWebAiiTest()
{
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
    ActiveBrowser.NavigateTo("http://vvs.de/");
    Find.ById<HtmlDiv>("twitterFCE").MouseClick();
    Manager.SetNewBrowserTracking(true);
    Manager.WaitForNewBrowserConnect("http://twitter.com/VVS#", true, 6000);
    Manager.SetNewBrowserTracking(false);
}

I searched the whole web but everyone is doing the same like in my code.

There are 2 other questions I have:
1. I must interact with at least 1 object/element within my browser that it can detect an iframe --> why?
2. Is Telerik testing Framework compatible to FF 15.0? I am not able to initialize any tests
Plamen
Telerik team
 answered on 13 May 2013
2 answers
172 views
We have a WPF application we are trying to automate and I am having trouble performing complex key presses. We have a control that responds to CTRL+ALT+SHIFT+T which works when manually entered however using both of the 2 different methods below it fails to work. Please note that simpler 3 key combos work on the same control using Method 2 below but I have not tried using method 1.

Method 1
control.User.Click(MouseClickType.LeftClick);
var keys = ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString("SHIFT+CTRL+ALT+T");
AtlasApp.Manager.Desktop.KeyBoard.KeyPress(keys, 500);

Method 2         
control.User.Click(MouseClickType.LeftClick);
AtlasApp.Manager.Desktop.KeyBoard.KeyDown(Keys.Control);                   
AtlasApp.Manager.Desktop.KeyBoard.KeyDown(Keys.Alt);
AtlasApp.Manager.Desktop.KeyBoard.KeyDown(Keys.Shift);
AtlasApp.Manager.Desktop.KeyBoard.KeyPress(Keys.T);
AtlasApp.Manager.Desktop.KeyBoard.KeyUp(Keys.Shift);
AtlasApp.Manager.Desktop.KeyBoard.KeyUp(Keys.Alt);
AtlasApp.Manager.Desktop.KeyBoard.KeyUp(Keys.Control);
Max
Top achievements
Rank 1
 answered on 10 May 2013
3 answers
125 views
Hi,

I want to check a condition weather dialog box exist or not.

    If (the dialog box exists) then 
        i need to click on yes button
    Else
        No action

plz provide code to do this
   
Plamen
Telerik team
 answered on 09 May 2013
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?