Find an item based on text string

6 posts, 1 answers
  1. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 06 Sep 2011 Link to this post

    Ok so I'm at a grid of contact form submissions...

    In my recorded test submission I put in some text like "This is a Test Submission"

    So now in the grid I need to find that item...click it, then click a delete button

    What's the best way to do that?
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 08 Sep 2011 Link to this post

    Hi Steve,

    Can you provide us with additional information on your automation scenario? What type of grid are you testing?
    Is your application accessible for us to test directly? If not, does a public site exhibit the same behavior? Are you automating in Test Studio or directly in code?

    If you'd like to attach additional details, such as a copy of the test (within a zip file), you can create a support ticket which is confidential unlike this forum.

    Regards,
    Anthony
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  3. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 08 Sep 2011 Link to this post

    It's a sitefinity form, so I guess you could install a new copy :)

    - Create form
    - Put it on a page
    - Submit results
    - Find them in the backend and delete (amidst the other submissions)

    Although now that I think about it, I should just do a coded test to delete all submissions with X text... ;)
  4. Answer
    Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 09 Sep 2011 Link to this post

    Hello Steve,

    I was able to accomplish this scenario in Sitefinity with three tests: Parent, CreateContact, and DeleteContact.

    The Parent test is data driven. The local data table has a "Comment" column. It contains the CreateContact and DeleteContact tests as Test as Steps.

    The InheritParentDataSource property of CreateContact and DeleteContact is enabled.

    The CreateContact test fills in information on the form and submits it. The Message text box entry step is bound to the "Comment" column in the data.

    The DeleteContact test logs into the backend and goes to the page with the grid of submissions (actually a table). In a coded step I locate the Div, Table, and Div within the table cell that contains the "Comment" data:

    HtmlDiv cts = Find.ByAttributes<HtmlDiv>("id=frmRspnsesCntView_formsBackendListDetail_ctl00_ctl00_splitter");
     
    HtmlTable tbl = cts.Find.ByAttributes<HtmlTable>("id=frmRspnsesCntView_formsBackendListDetail_ctl00_ctl00_ctl00_ctl00_ctl00_itemsGrid_ctl00_ctl00_grid_ctl00");
     
    HtmlDiv tt = tbl.Find.ByContent<HtmlDiv>(Data["Comment"].ToString());
    tt.Click();

    Please see here for more information on data driving find expressions.

    All the best,
    Anthony
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  5. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 09 Sep 2011 Link to this post

    Hmmm, so this means I'd leave Test Studio, and open the test in express to add in the coded step then?

    Would I be able to see a screenshot or a JING of your setup on this test by any chance at all? :D?
  6. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 09 Sep 2011 Link to this post

    Hello Steve,

    No, you can easily add a coded step in the Standalone version with our Script Step feature.

    Here is a list of each screen shot attached and a brief description of each:

    1. The Parent test. It calls each child test via the Test as Step feature.
    2. The Local Data table of the Parent test.
    3. The project tab. Highlight each child test and enable its InheritParentDataSource property.
    4. The CreateContact child test. Step 8 is highlighted to show it is data bound to the "Comment" column from the Parent's data table. Notice how that is set on the right in the Data Driven Editor.
    5. The DeleteContact child test. Step 11 is the coded step that clicks the appropriate area of the table that contains the data from the "Comment" column.

    Kind regards,
    Anthony
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Back to Top