josette_merhy12
12 years agoOccasional Contributor
Input of type hidden not found in Script.
i have the following element: <div> <input type="hidden" data-u-id="numberOfSeats" name="NumberOfSeats" required="required"><span class="atom_validation_bsy required" style="">Required field</sp...
- 12 years ago
Hi Josette,
I guess you are using the Tree model in your project, right? This model doesn't show hidden elements in the object structure. So, it's impossible to call the methods you used to get the object. You need to use the EvaluateXPath or FindChildByXPath method to find elements by the values of the element’s attributes on the HTML page.
For example:
var page = //obtain the page
// Call the function
var tmp = page.EvaluateXPath("//INPUT[@name='NumberOfSeats']");
// 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();
// do what you want with the element
}
else
{
Log.Error("The element was not found.");
}
}