-
-
-
-
-
System.NullReferenceException: Object reference not set to an instance of an object.
-
-
-
-
I’m trying to do a few things in the Grid that Telerik Automation can’t do in Code. We have a products list that contains a button with the product name and the expiration date in the HTML Grid.
Part one is to gather the button’s names with the Expiration Date. Then we will do the account updates then run another test that will validate no changes are done. I need this to be data driven. The issue is that I encounter errors.
Exception thrown executing coded step: '[Row_Index] : @"Indxing through Active'.
InnerException:
System.NullReferenceException: Object reference not set to an instance of an object.
at PortalC_Sharp.ExpDate_Extract.Row_Index() in C:\MyProjects\PortalC_Sharp\ExpDates\ExpDate Extract.tstest.cs:line 119
------------------------------------------------------------
'8/8/2012 9:23:57 AM' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.
Can you look at my code to see what I’m doing wrong?
Thanks,
John
<TBODY> <TR> <TD style="WIDTH: 100%"> <TABLE width="100%" align=left> <TBODY> <TR vAlign=top> <TD style="WIDTH: 100%; COLOR: navy; FONT-WEIGHT: bold" align=left><A style="WIDTH: 135px; DISPLAY: inline-block" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rbProduct class="RadButton RadButton_Windows7 rbSkinnedButton" href="javascript:void(0)"><INPUT style="PADDING-LEFT: 4px; WIDTH: 100%; PADDING-RIGHT: 0px" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rbProduct_input class=rbDecorated tabIndex=-1 value=E-dition type=submit name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl02$rbProduct_input><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rbProduct_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rbProduct_ClientState autocomplete="off"></A> </TD> <TD style="WIDTH: 100%" noWrap align=right><IMG id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_imgAttention src="Images/error.png"> <DIV style="POSITION: absolute; DISPLAY: none" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rtAttention><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rtAttention_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_rtAttention_ClientState autocomplete="off"> </DIV></TD> <TD noWrap align=right><SPAN style="COLOR: darkgreen" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_lblExpiration>Expiration: Jan 01, 2013</SPAN> </TD></TR> <TR vAlign=top> <TD colSpan=3 align=left><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl02_lblMessage value="Now current standards are just a few clicks away with E-dition, delivering 24/7 web-based access to all content in the printed <i>Joint Commission Comprehensive Accreditation Manual</i>. Quick-click navigation and automatic updates provide you with the essential standards information you and your staff need. Full-text searching delivers rapid access to topics and you can use filtering and service profilesto tailor views to your needs. Plus, quickly understand how Joint Commission elements of performance relate to CMS requirements through our interactive crosswalk. " type=hidden name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl02$lblMessage> <SPAN id=message>Now current standards are just a few clicks away with E-dition, delivering 24/7 web-based access to all </SPAN> <IMG style="FLOAT: right; CLEAR: right" id=imgToggleMessage src="http://sandweb2k8.jcaho.net:42111/Images/Icons/iconShowMore.gif" jQuery1703061065552459071="1"></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD style="WIDTH: 100%"> <TABLE width="100%" align=left> <TBODY> <TR vAlign=top> <TD style="WIDTH: 100%; COLOR: navy; FONT-WEIGHT: bold" align=left><A style="WIDTH: 135px; DISPLAY: inline-block" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rbProduct class="RadButton RadButton_Windows7 rbSkinnedButton" href="javascript:void(0)"><INPUT style="PADDING-LEFT: 4px; WIDTH: 100%; PADDING-RIGHT: 0px" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rbProduct_input class=rbDecorated tabIndex=-1 value=AMP type=submit name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl03$rbProduct_input><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rbProduct_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rbProduct_ClientState autocomplete="off"></A> </TD> <TD style="WIDTH: 100%" noWrap align=right><IMG id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_imgAttention src="Images/4CR.png"> <DIV style="POSITION: absolute; DISPLAY: none" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rtAttention><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rtAttention_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_rtAttention_ClientState autocomplete="off"> </DIV></TD> <TD noWrap align=right><SPAN style="COLOR: darkgreen" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_lblExpiration>Expiration: Jan 01, 2013</SPAN> </TD></TR> <TR vAlign=top> <TD colSpan=3 align=left><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl03_lblMessage value="Accreditation Manager Plus (AMP®) is the software solution for managing your continuous compliance preparation process. AMP simplifies self-assessment across your organization and provides a central location for all accreditation activities. When it comes time to completing your organization's PPR, simply export your AMP scoring data directly to The Joint Commission site." type=hidden name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl03$lblMessage> <SPAN id=message>Accreditation Manager Plus (AMP®) is the software solution for managing your continuous compliance prepa</SPAN> <IMG style="FLOAT: right; CLEAR: right" id=imgToggleMessage src="http://sandweb2k8.jcaho.net:42111/Images/Icons/iconShowMore.gif" jQuery1703061065552459071="2"></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD style="WIDTH: 100%"> <TABLE width="100%" align=left> <TBODY> <TR vAlign=top> <TD style="WIDTH: 100%; COLOR: navy; FONT-WEIGHT: bold" align=left><A style="WIDTH: 135px; DISPLAY: inline-block" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rbProduct class="RadButton RadButton_Windows7 rbSkinnedButton rbDisabled" disabled href="javascript:void(0)"><INPUT style="PADDING-LEFT: 4px; WIDTH: 100%; PADDING-RIGHT: 0px" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rbProduct_input class=rbDecorated disabled tabIndex=-1 value=ECM type=submit name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl04$rbProduct_input><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rbProduct_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rbProduct_ClientState autocomplete="off"></A> </TD> <TD style="WIDTH: 100%" noWrap align=right><IMG id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_imgAttention src="Images/error.png"> <DIV style="POSITION: absolute; DISPLAY: none" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rtAttention><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rtAttention_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_rtAttention_ClientState autocomplete="off"> </DIV></TD> <TD noWrap align=right><SPAN style="COLOR: maroon" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_lblExpiration>Expiration: Mar 02, 2012</SPAN> </TD></TR> <TR vAlign=top> <TD colSpan=3 align=left><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl04_lblMessage value="E-dition Compliance Monitor (ECM™) is an online library of health care industry regulations, organized and linked by Joint Commission Hospital Standards, designed to help you navigate the laws, regulations, and daily actions made by various government and regulatory agencies.<br/><br/>By having a central repository for standards and regulatory information, ECM gives you the tools you need to help reduce risk, avoid costly compliance deficiencies, and ultimately improve patient safety.<br/><br/>Updated daily, ECM features the easy-to-use E-dition® interface and navigation, and provides expanded search and filter features for quick retrieval of information. This software also features a “What’s New” e-mail alert tailored to your specific areas of interest." type=hidden name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl04$lblMessage> <SPAN id=message>E-dition Compliance Monitor (ECM™) is an online library of health care industry regulations, organized a</SPAN> <IMG style="FLOAT: right; CLEAR: right" id=imgToggleMessage src="http://sandweb2k8.jcaho.net:42111/Images/Icons/iconShowMore.gif" jQuery1703061065552459071="3"></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD style="WIDTH: 100%"> <TABLE width="100%" align=left> <TBODY> <TR vAlign=top> <TD style="WIDTH: 100%; COLOR: navy; FONT-WEIGHT: bold" align=left><A style="WIDTH: 135px; DISPLAY: inline-block" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rbProduct class="RadButton RadButton_Windows7 rbSkinnedButton" href="javascript:void(0)"><INPUT style="PADDING-LEFT: 4px; WIDTH: 100%; PADDING-RIGHT: 0px" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rbProduct_input class=rbDecorated tabIndex=-1 value=Tracers type=submit name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl05$rbProduct_input><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rbProduct_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rbProduct_ClientState autocomplete="off"></A> </TD> <TD style="WIDTH: 100%" noWrap align=right><IMG id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_imgAttention src="Images/4CR.png"> <DIV style="POSITION: absolute; DISPLAY: none" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rtAttention><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rtAttention_ClientState type=hidden name=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_rtAttention_ClientState autocomplete="off"> </DIV></TD> <TD noWrap align=right><SPAN style="COLOR: darkgreen" id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_lblExpiration>Expiration: Jan 01, 2013</SPAN> </TD></TR> <TR vAlign=top> <TD colSpan=3 align=left><INPUT id=ctl00_cphApp_rdProducts_C_grdMyProducts_ctl05_lblMessage value="An online tool that allows users to record, track and trend internal Tracer activities by creating a custom tracer from existing Joint Commission Resources templates of questions or from questions customized or created by your organization." type=hidden name=ctl00$cphApp$rdProducts$C$grdMyProducts$ctl05$lblMessage> <SPAN id=message>An online tool that allows users to record, track and trend internal Tracer activities by creating a cus</SPAN> <IMG style="FLOAT: right; CLEAR: right" id=imgToggleMessage src="http://sandweb2k8.jcaho.net:42111/Images/Icons/iconShowMore.gif" jQuery1703061065552459071="4"></TD></TR></TBODY></TABLE></TD></TR></TBODY>[
CodedStep(@"Indxing through Active")]
public void Row_Index()
{
HtmlTable ContenthtmlTable = Pages.JointCommissionResources6.MyActive.Find.ById<HtmlTable>("ctl00_cphApp_rdProducts_C");
HtmlDiv gridDiv = Find.ById<HtmlDiv>("ctl00_cphApp_rdProducts_C");
HtmlDiv content = gridDiv.Find.ByAttributes<HtmlDiv>("id=ctl00_cphApp_rdProducts_C_grdMyProducts");
HtmlTable table = content.Find.ByTagIndex<HtmlTable>("table", 0);
Log.WriteLine(
"***********************************************");
Log.WriteLine(
"Rows Count: " + table.Rows.Count.ToString());
Log.WriteLine(
"***********************************************");
foreach (HtmlTableRow row in table.AllRows)
{
foreach (HtmlTableCell cell in row.Cells)
{
Log.WriteLine(cell.InnerText);
}
}
}
public void CanObserveCellContent(){ var grid = wpfApp.MainWindow.Find.ByName<RadGridView>("_searchResults"); grid.Rows[0].User.Click(MouseClickType.LeftDoubleClick); //other steps and assertions}Assert.AreEqual("Test1", grid.Rows[0].Cells[0].Text);Sometime Expressions doesn't work.
For example:
public static readonly HtmlFindExpression ProjectLabelInProjectsTree = new HtmlFindExpression("id=projectTree", "|", "class=rf-tr-nd-colps", "|", "class=rf-trn-cnt"); Find.ByExpression<HtmlSpan>(MainTestPageObjects.ProjectLabelInProjectsTree).Click();
<div id="projectTree" class="rf-tr"> <div id="projectTree:1st - Projects:j_idt43" class="rf-tr-nd rf-tr-nd-colps firefinder-match"> <div id="j_idt43" class="rf-trn firefinder-match"> <span class="rf-trn-hnd-colps rf-trn-hnd"></span> <span class="rf-trn-cnt rf-trn-sel"> </div> </div> <div id="projectTree:2nd - Deploy Configurations:j_idt52" class="rf-tr-nd rf-tr-nd-lf rf-tr-nd-last"> <div id="j_idt52" class="rf-trn firefinder-match"> <span class="rf-trn-hnd-lf rf-trn-hnd"></span> <span class="rf-trn-cnt"> </div> </div>code return exception -
Pages.USSPOSCOIndustries.FrameHome.SilverlightApp.GridviewEarnings.NewRowTelerik.WebAii.Controls.Xaml.RadGridView rgv = Pages.USSPOSCOIndustries.FrameHome.SilverlightApp.GridviewEarnings;int rowCounter = rgv.Rows.Count;int cellCounter = 1; foreach(Telerik.WebAii.Controls.Xaml.GridViewCell gCell in Pages.USSPOSCOIndustries.FrameHome.SilverlightApp.GridviewEarnings.NewRow) { //Nested loop; Goes through all the cells within each row if (gCell.XamlTag == "textbox" && gCell.AutomationId == "PART_EditableTextBox") gCell.Text = (string)(System.Convert.ChangeType(Data["Hours"], typeof(string))); //You can implement any type of verification you like against the text here if (gCell.XamlTag == "selectivescrollinggrid" && gCell.Name == "grid") gCell.Text = (string)(System.Convert.ChangeType(Data["Hours"], typeof(string))); //You can implement any type of verification you like against the text here cellCounter++; } rowCounter++;
Pages.USSPOSCOIndustries.FrameHome.SilverlightApp.GridviewEarnings.AddNewRow();