Forum Discussion

marin's avatar
marin
Frequent Contributor
13 years ago

How to capture value of a hidden input field

Hello all,



I wonder if it is possible to capture the value of a hidden input field on a page?

There is a thread in the forum where it is explained how to do it using DOM or Hybrid model, but in TestComplete 9 there are only 2 models now: Tree and Flat.



Is there another possibility to somehow capture the value of a hidden field on a page from TestComplete script?

I am using the latest TestComplete 9.0.1069.7



Many thanks,



Marin

1 Reply

  • marin's avatar
    marin
    Frequent Contributor
    ...found out in the meantime (this thread was helpful).



    >

    Normal
    0


    21


    false
    false
    false

    DE
    X-NONE




























    var tmp = page.EvaluateXPath("//INPUT[@id = 'myId']");  //searching for input element with ID "myId"



      // Check the result

      if (tmp != null)

      {

        // If the element was found,

        // convert the array to the JScript-compatible format

        var arr = (new VBArray(tmp)).toArray();

        // and capture the value

        var temp2 = arr[0].Value;

      }

      else

      {

        // If the element was not found, post a message to the log

        Log.Error("The element was not found.");

      }