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

dynamic grid

3 Answers 88 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tanu
Top achievements
Rank 1
Tanu asked on 11 Feb 2013, 11:27 AM
Using http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/html/dynamic-grid.aspx i tried to automate a grid with code

HtmlTableRow containerRow =

 

null;

 

foreach

 

 

(HtmlTableRow r in Pages.EndpointClinicalPulse.LandingPageTable.AllRows)

 

{

 

 

foreach(HtmlTableCell c in r.Cells)

 

{

Log.WriteLine(

 

"Cell Found.TextContent:"+c.InnerText);

 

 

 

if(c.InnerText.Equals("Messaging_Test_Study"))

 

{

containerRow = c.Parent<HtmlTableRow>();

}

}

}

HtmlTableCell cbutton = containerRow.Cells[

 

6];

 

Log.WriteLine(cbutton.InnerText);

cbutton.ScrollToVisible();

cbutton.Click();

Issue is...cells[6] is in another table. Grid is like as shown

A B C D E F button
A1 B1 C1 D1 E1 F1 button
A2 B2 C2 D2 E2 F2 button

above is a grid which contains a table. Also "button" is further in another table

 

 

I am able to read the content of cells[6](ie text "button" is getting printed in log) but unable to click the button in cells[6]

 

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 13 Feb 2013, 05:07 PM
Hi Tanu,

Try using a real mouse click instead:
cbutton.MouseClick();

If this doesn't work, try to find the 'button' in the cell. Here's a sample code:
var button = cbutton.Find.AllByTagName("button").FirstOrDefault().As<HtmlControl>();
button.MouseClick();

Please try the suggestions above and let me know if this helps.

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Tanu
Top achievements
Rank 1
answered on 14 Feb 2013, 09:54 AM
Hi Plamen,

Real mouse click is not working. Also getting the following error on using the second option

Failure Information: ~~~~~~~~~~~~~~~Exception thrown executing coded step: '[WebTest_CodedStep] : New Coded Step'.InnerException:System.NullReferenceException: Object reference not set to an instance of an object. at TestProject3.WebTest.WebTest_CodedStep() in c:\Users\Tanu\Documents\Test Studio Projects\TestProject3\WebTest.tstest.cs:line 95------------------------------------------------------------'2/14/2013 1:34:21 PM' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.

0
Plamen
Telerik team
answered on 14 Feb 2013, 10:27 AM
Hi Tanu,

Unfortunately to be able to help you further with this problem a local reproduction is needed. Please provide us with a copy of your test and access to your application. If it is not possible to grant us access to your application, please take a Fiddler trace using FiddlerCap and send it to us in a zip file. If you deem that information too sensitive for this forum, you can create a support ticket and attach it there. Thanks for providing the information we need to best assist you.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Tanu
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Tanu
Top achievements
Rank 1
Share this question
or