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

Navigate to another page and test its elements

9 Answers 173 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nicolas
Top achievements
Rank 1
Nicolas asked on 18 Aug 2011, 05:20 PM
Hello,
the principle of my test is to click on a link from a page, which brings me to another page
My problem is that Telerik can not test the elements of this new page?
how in this case?
Best Regards

9 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 18 Aug 2011, 06:29 PM
Hello Nicolas,

Is your application HTML or Silverlight? Does the new page load in the same browser window or in a pup-up window? If it's a pop-up, is it HTML or Modal? Do you mean that no actions are recorded on the new page? Or does hover over highlighting not work?

As you can see there are many variables and the more information you can provide, the better. If the app you're testing is publicly accessible we'd like to test it directly and reproduce the issue. A copy of the test or the entire project (within a .zip file) would be helpful.

If you can record actions and verifications against the new page yet one of those steps fails, please provide the Step Failure Details by using the "Export Result to File" feature.

All the best,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Nicolas
Top achievements
Rank 1
answered on 19 Aug 2011, 10:28 AM
hello;

Thank you first for your reply ;
1-My applicaion  is an  html application (web)
2-The loading of the browser is in a new html page 
My application is not accessible to the public, it is not yet in production,
its principle is as if we did a search on google, you click on a link and you fall on a new page to test these elements
the error message I received on most of these steps is unsuccessful:
System.NullReferenceException: Object reference not set to instance of year year object.

best regards
0
Anthony
Telerik team
answered on 19 Aug 2011, 04:21 PM
Hello Nicolas,

Thanks for the additional information. Unfortunately that error message is broad and doesn't tell us much out of context. The Step Failure Details feature I mentioned in my previous post is the most robust way to provide us with as much information about the failure as possible.

All the best,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Nicolas
Top achievements
Rank 1
answered on 22 Aug 2011, 02:15 PM
Hello; and thank you for your reply ,,
below, a test result of an iteration that contains Fails

'8/22/2011 2:25:42 PM' - [Iteration #14: (SubscriberId=R0022298434)(RecordType=R)(InitialFlag=False)(ReverseFlag=False)(AddressFlag=False)(AntiprospectionFlag=True)(Nom=Raguin)(Prenom=Jean)(Nom-Prenom=Raguin Jean)(Tel=03.84.92.30.67)(Numvoie=)(Libvoie=CHEMIN COMMUNAL)(CodPos=70230)(LibCom=BOUHANS LES MONTBOZON)]
------------------------------------------------------------
Overall Result: Fail
'8/22/2011 2:25:45 PM' - 'Pass' : 1. Navigate to : 'http://www.118000portage.fr/'
'8/22/2011 2:25:48 PM' - 'Pass' : 2. [TestPageDetails_CodedStep] : Click 'ProfessionnelsLink'
'8/22/2011 2:25:51 PM' - 'Pass' : 3. [TestPageDetails_CodedStep1] : remplir les champs Qui?Quoi?Ou,
'8/22/2011 2:25:58 PM' - 'Pass' : 4. Click 'Submit'
'8/22/2011 2:26:04 PM' - 'Pass' : 5. Click 'CEstVotreLink'
'8/22/2011 2:26:04 PM' - 'Fail' : 6. [TestPageResults_CodedStepName] : PRENOM
------------------------------------------------------------
Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[TestPageResults_CodedStepName] : PRENOM'.
InnerException:
System.NullReferenceException: Object reference not set to an instance of an object.
   at ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.AssertContent.InnerText(StringCompareType compareType, String expectedValue)
   at FlagsTest.TestPageDetails.TestPageResults_CodedStepName() in c:\Projects\NonRegressionTests\FlagsTestProject\TestPageDetails.aii.cs:line 87
------------------------------------------------------------
'8/22/2011 2:26:04 PM' - Detected a failure. Step is marked 'ContinueOnFailure=True' continuing test execution.
'8/22/2011 2:26:04 PM' - 'Fail' : 7. [TestPageResults_CodedStep] : TELEPHONE
------------------------------------------------------------
Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[TestPageResults_CodedStep] : TELEPHONE'.
InnerException:
ArtOfTest.Common.Exceptions.AssertException: String match failed (CompareType:Exact). - [Expected:03.84.92.30.67],[Actual: ]
   at ArtOfTest.WebAii.Controls.BaseControlAssert`1.Assert(Boolean condition, String message, String expected, String actual, Boolean throwAssert)
   at ArtOfTest.WebAii.Controls.BaseControlAssert`1.AssertString(String expected, String actual, StringCompareType compareType, Boolean throwOnFailure)
   at ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.AssertContent.InnerText(StringCompareType compareType, String expectedValue)
   at FlagsTest.TestPageDetails.TestPageResults_CodedStep() in c:\Projects\NonRegressionTests\FlagsTestProject\TestPageDetails.aii.cs:line 104
------------------------------------------------------------
'8/22/2011 2:26:04 PM' - Detected a failure. Step is marked 'ContinueOnFailure=True' continuing test execution.
'8/22/2011 2:26:09 PM' - 'Pass' : 8. [TestPageResults_CodedStep1] : PICTO
'8/22/2011 2:26:10 PM' - 'Fail' : 9. [TestPageResults_CodedStep2] : EPINGLETTE*

Best regards

0
Anthony
Telerik team
answered on 22 Aug 2011, 05:05 PM
Hi Nicolas,

Step 6 fails on line 87 and step 7 fails on line 104. I'd need to see those and their surrounding lines for context. Step 7 specifically tells us its verification on string comparisons failed and why:

String match failed (CompareType:Exact). - [Expected:03.84.92.30.67],[Actual: ]

I successfully navigated to the URL in step 1 of your test. If your app is now publicly accessible, the fastest way for us to troubleshoot is to see the issue first-hand. You could attach your project (within a zip file) to a support ticket, which unlike this thread is confidential.

All the best,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Nicolas
Top achievements
Rank 1
answered on 29 Aug 2011, 03:35 PM
hello,

 My real problem is not the error messages but rather on the navigation to another page by clicking a link, or by extract and navigate to its URL(using Href in the page dom)
how to do this step in coded?

cordially
0
Anthony
Telerik team
answered on 29 Aug 2011, 05:29 PM
Hello Nicolas,

There are different methods to locate an element and click it in code.

One way is to find it based on its HREF, as you asked:

Element e = ActiveBrowser.Find.ByAttributes("href=http://www.google.com");
ActiveBrowser.Actions.Click(e);

You can find by any attribute you'd like, such as Id, Name, etc. Please see here for more information.

If your element has been added to your Element Repository (by using the Add to Project Elements feature), you can find it and click it with one line:

Pages.CHTMLCommaHtml.Pageheader0LnkManageMyAccountLink.Click();

If you were referencing a different method of extraction, please read our article on how to Data Bind an Extraction Step through the UI.

Finally, any normal step recorded through the UI can be customized in code by choosing that feature from the Test Step Context Menu. Just right click the step, convert to code, and start customizing. A converted step cannot be converted back, however.

All the best,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Nicolas
Top achievements
Rank 1
answered on 30 Aug 2011, 09:52 AM
Hello,
thank you first for your reply
Here is a code that I use on a stage of my tests
 When I run my test, pass the step is but I do not see the browser to the URL that j'extracte:
 [CodedStep(@"Click 'Navigate to link'")]
        public void TestImpresionPageResults_CodedStep()
        {      
         var printDiv= ActiveBrowser.Find.ByExpression<HtmlAnchor>(new HtmlFindExpression("id=list-print","|","href=~print"));
          string url;
            foreach (iAttribute attr in printDiv.Attributes)
              {
                {
                  if (attr.Name.Equals("href"))
                  url = attr.Value;
                  break;             
                 }  
            Log.WriteLine("sLienEncode = "+url);
            ActiveBrowser.NavigateTo(url);
        }
Best regards
0
Accepted
Anthony
Telerik team
answered on 30 Aug 2011, 06:33 PM
Hi Nicolas,

I think your brackets are simply out of order. In my test I also had to initialize the string "url" as null. Try this instead:

var printDiv= ActiveBrowser.Find.ByExpression<HtmlAnchor>(new HtmlFindExpression("id=list-print","|","href=~print"));

//I inserted the following Assert to assure the above find logic was correct.
//Assert.IsNotNull(printDiv);
string url = null;
foreach (iAttribute attr in printDiv.Attributes)
     {
          if (attr.Name.Equals("href"))
               {
                    url = attr.Value;
                    break;            
               }
       } 

Log.WriteLine(
"sLienEncode = "+url);
ActiveBrowser.NavigateTo(url);


Regards,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Tags
General Discussions
Asked by
Nicolas
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Nicolas
Top achievements
Rank 1
Share this question
or