Error 1 The type 'PortalC_Sharp.ExpDates.HtmlTable' cannot be used as type parameter 'TControl'

2 posts, 0 answers
  1. John
    John avatar
    8 posts
    Member since:
    Jul 2012

    Posted 08 Aug 2012 Link to this post

    When pasting the sample code from the demo code, I see the following error:

    Exception thrown executing coded step: '[Row_Index] : @"Indxing through Active'.
    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.

    Error 1 The type 'PortalC_Sharp.ExpDates.HtmlTable' cannot be used as type parameter 'TControl' in the generic type or method 'ArtOfTest.WebAii.Core.Find.ByExpression<TControl>(params string[])'. There is no implicit reference conversion from 'PortalC_Sharp.ExpDates.HtmlTable' to 'ArtOfTest.WebAii.Controls.Control'. C:\MyProjects\PortalC_Sharp\ExpDates\HtmlTable.tstest.cs 76 31 PortalC_Sharp

    Code Entered:

    HtmlTable table = Find.ByExpression<HtmlTable>("id=Grid", "|", "tagIndex=table:1");
    HtmlSpan next = Find.ByExpression<HtmlSpan>("class=t-icon t-arrow-next");
    HtmlAnchor a = Find.ByExpression<HtmlAnchor>("href=/aspnet-mvc/Grid?ajax=True&Grid-page=2");

  2. Jasper
    Jasper avatar
    5 posts

    Posted 09 Aug 2012 Link to this post

    Hello John,

    I just took a look at this, and it looks like there might be a bug in our find logic. I've submitted a bug here:

    In the interim, you can work around this issue by changing the manner in which the HtmlAnchor is found:

    HtmlAnchor a = next.Parent<HtmlAnchor>()

    Try applying that code change to the example and see if things work better for you.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top