Extracting variable from input type="hidden"

2 posts, 0 answers
  1. Ivomir Assi
    Ivomir Assi avatar
    1 posts
    Member since:
    Dec 2012

    Posted 19 Jun 2013 Link to this post

    This is the input :

    <input type="hidden" name="ctl00$SampleContent$ThaiRating_RatingExtender_ClientState" id="ctl00_SampleContent_ThaiRating_RatingExtender_ClientState" value="2">

    I want to find the element by id and to extract its value in a variable. How to do it?
    This is my approach -> http://screencast.com/t/oplfW5f0d

    I'm familiar with C# so if you have any idea how to do it with script step - OK

  2. Boyan Boev
    Boyan Boev avatar
    1072 posts

    Posted 20 Jun 2013 Link to this post

    Hello Assi,

    This can be done easily in a coded step. After you have added the element to the Element explorer:

    SetExtractedValue("myVariable", Pages.MySite.MyHiddenElement.Value.ToString());

    See this video for a demonstration.

    Hope this helps.

    Boyan Boev
    Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
    Reserve your seat today!
Back to Top