Pages.Online7.FrameNavigationPanel.LblErrorTitleSpan.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "Sorry there was an error displaying your report."); or Pages.Online7.FrameNavigationPanel.LblErrorTitleSpan.BaseElement.Wait.ForCondition((a_0, a_1) => ArtOfTest.Common.CompareUtils.StringCompare(a_0.TextContent, "Sorry there was an error displaying your report.", ArtOfTest.Common.StringCompareType.Contains), false, null, 10000); if (Pages.Online7.FrameNavigationPanel.LblErrorTitleSpan.IsEnabled) or if (Pages.Online7.FrameNavigationPanel.LblErrorTitleSpan.IsVisible()) { Code to move to next webpage Pages.Online4.ImgRightArrow.Click(false); } else{ Some Code to perform actions on the rendered webpage }{
(...) # get data from sql Random r = new Random(); int val = r.Next(0, t.Rows.Count - 1); var row = t.Rows[val]; GridViewRow ro = Pages.App.SilverlightApp.Get<GridViewRow>("TextContent=" + row[0].ToString(), "XamlTag=textblock"); Debug.WriteLine("Index: " + ro.Index.ToString());ro.User.Click(MouseClickType.LeftDoubleClick);} Can someone tell me how can I get the Index, RowIndex of this (ro) row. FromDebug.WriteLine("Index: " + ro.Index.ToString());I get always "0".
Failure Information: ~~~~~~~~~~~~~~~Exception thrown executing coded step: '[writing_CodedStep] : Navigate to : 'http://pxsnydmsapp001v.dts.dadcdigital.com/''.InnerException:System.ArgumentException: Index '0' is invalid. List contains only '0' apps at ArtOfTest.WebAii.Silverlight.SilverlightAppsList.get_Item(Int32 index)
"using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
namespace Project_Saurabh
{
//
// You can add custom execution steps by simply
// adding a void function and decorating it with the [CodedStep]
// attribute to the test method.
// Those steps will automatically show up in the test steps on save.
//
// The BaseWebAiiTest exposes all key objects that you can use
// to access the current testcase context. [i.e. ActiveBrowser, Find ..etc]
//
// Data driven tests can use the Data[columnIndex] or Data["columnName"]
// to access data for a specific data iteration.
//
// Example:
//
// [CodedStep("MyCustom Step Description")]
// public void MyCustomStep()
// {
// // Custom code goes here
// ActiveBrowser.NavigateTo("http://www.google.com");
//
// // Or
// ActiveBrowser.NavigateTo(Data["url"]);
// }
//
public class writing : BaseWebAiiTest
{
#region [ Dynamic Pages Reference ]
private Pages _pages;
/// <summary>
/// Gets the Pages object that has references
/// to all the elements, frames or regions
/// in this project.
/// </summary>
public Pages Pages
{
get
{
if (_pages == null)
{
_pages = new Pages(Manager.Current);
}
return _pages;
}
}
#endregion
// Add your test methods here...
[CodedStep(@"Navigate to : "AUT")]
public void writing_CodedStep()
{
// Navigate to : '"AUT"'
string landingpage;
// Create my own Settings object and then modify the defaults
Settings mySettings = new Settings();
mySettings.EnableSilverlight = true;
mySettings.DefaultBrowser = BrowserType.InternetExplorer;
mySettings.ClientReadyTimeout = 60000;
Manager.LaunchNewBrowser();
// Use my Settings object to construct my Manager object
Manager myManager = new Manager(mySettings);
System.Threading.Thread.Sleep(5000);
myManager.Start();
myManager.LaunchNewBrowser();
myManager.ActiveBrowser.NavigateTo("AUT");
Element mybtn = myManager.ActiveBrowser.Find.ByName("Login1$UserName");
System.Threading.Thread.Sleep(2000);
myManager.ActiveBrowser.Actions.SetText(mybtn,"username");
System.Threading.Thread.Sleep(2000);
Element mybtn1 = myManager.ActiveBrowser.Find.ByName("Login1$Password");
System.Threading.Thread.Sleep(2000);
myManager.ActiveBrowser.Actions.SetText(mybtn1,"password");
System.Threading.Thread.Sleep(2000);
Element mybtn2 = myManager.ActiveBrowser.Find.ByName("Login1$LoginButton");
System.Threading.Thread.Sleep(2000);
myManager.ActiveBrowser.Actions.Click(mybtn2);
System.Threading.Thread.Sleep(2000);
System.Threading.Thread.Sleep(60000);
ActiveBrowser.RefreshDomTree();
SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; // THE LINE WHICH THROWS ERROR/EXCEPTION
}
}
}
string path = "/some/path/";string root = "localhost:900";var cookie = new Cookie( CookieName, CookieValue, path, root) { Expires = DateTime.UtcNow.AddDays(CookieExpireInDays) };TelerikProxy.ActiveBrowser.Cookies.SetCookie(cookie);var userCookieAfterLogin = TelerikProxy.ActiveBrowser.Cookies.GetCookies("http://" + root + path);
CollectionAssert.IsNotEmpty(userCookieAfterLogin);
string root = "localhost";string root = "127.0.0.1";
Manager.SetNewBrowserTracking(true);Find.ById<HtmlAnchor>("OfferDescription_code").MouseClick();Manager.WaitForNewBrowserConnect(AD_SITE, true, 9999);Manager.ActiveBrowser.WaitUntilReady();Assert.IsTrue(Manager.Browsers.Count == 2);