'Tag collection is either empty or has less elements' after Customize step in code

3 posts, 0 answers
  1. Alan
    Alan avatar
    6 posts
    Member since:
    Aug 2011

    Posted 12 Mar 2013 Link to this post

    Hello,

    In several instances, I have needed to enter DateTime.Now.ToString() into a textbox, so I would initially record step to "enter text 'alan' into txtComment" and then customize that step in code.  I use to have success in this, but within the past few months, I have not.  I have even tried converting the step without modifying anything and I receive the same error.  Below is what I have tried so far.  We are using version 2012.2.1420.

    Pages...txtComment.Value = DateTime.Now.ToString();
    Actions.SetText(Pages...txtComment, DateTime.Now.ToString());

    As stated above, when simply converting the step to code, the test fails:

    Actions.SetText(Pages...txtComment, "alan");

    I know this is very simple to do, so I must be overlooking something.

    Thanks,
    Alan
  2. Byron
    Admin
    Byron avatar
    184 posts

    Posted 15 Mar 2013 Link to this post

    Hello Alan,

    I'm sorry you're running into this difficulty. In general, the approach you used should work. For example, after navigating to http://www.bing.com, the coded step:

    // Enter current date and time in 'SbFormQText'
    Pages.Bing.SbFormQText.Value = DateTime.Now.ToString();

    enters a current date string into the Bing search field. Likewise with:

    // Enter current date and time in 'SbFormQText'
    Actions.SetText(Pages.Bing.SbFormQText, DateTime.Now.ToString());

    Please provide more information on the error you receive, as well as a sample test project that produces the behavior, and we will help you resolve this issue.
    All the best,
    Byron
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Alan
    Alan avatar
    6 posts
    Member since:
    Aug 2011

    Posted 17 Apr 2013 Link to this post

    Apologies for the delayed response...thanks for the info, but I am still experiencing the issue.  I will submit a ticket.

    Alan
Back to Top