+

Search Tips   |   Advanced Search

Extract a form parameter value

Content:

<form action="doit.jsp" method="post">
    <input type="hidden" name="myHiddenField" value="hidden information">
    Name:      <input name="cn" type="text" value="filled value"><br>
    <input name="myRadioField" value="val1" type="radio">Radio Value 1<br>
    <input name="myRadioField" value="val2" type="radio" checked="checked">
    Radio Value 2<br>
    
    <input type="checkbox" name="myCheckbox" value="checkBoxValue" checked="checked">
    A checkbox<br>
    
    <select name="dropDownList">
      <option value="val1">list choice 1
      <option value="val2" selected>list choice 2
      <option value="val3">list choice 3
    </select><br>
    <input value="Send" type="submit"><input type="reset">
</form>

The form looks like this:


Extract from a text field

Content (value in quotation marks): <input name="cn" type="text" value="filled value">

Regex: <input name="cn" type="text" value="([^"]*)"

Content (value without quotation marks): <input name="cn" type="text" value=myvalue>

Regex: <input name="cn" type="text" value=([^\s>]*)

Comment: In each case, the brackets define the group whose value may be extracted in NeoLoad using $1$.

Advanced case: Where the web page contains several forms with text fields of the same name, the regex must contain the following:

<form action="doit.jsp" method="post">(.|\s)*?<input type=hidden name=myHiddenField value="([^"]*)"

Comments:


Extract from a hidden field

The hidden field is dealt with in a similar way to a normal text field. The input type value "hidden" is substituted for "text".

Content: <input type=hidden name=myHiddenField value="hidden information" >

Regex: <input type=hidden name=myHiddenField value="([^"]*)"


Extract from a radio button

Content: <input name="myRadioField" value="val2" type="radio" checked="checked" >Radio Value 2

Regex: <input name="myRadioField" value="([^"]*)" type="radio" checked="checked" >([^<\n]*)

Comments:


Extract from a checkbox

Content: <input type="checkbox" value="checkBoxValue" name="myCheckbox" checked="checked">A checkbox

Regex: <input type="checkbox" value="([^"]*)" name="myCheckbox" checked="checked">([^<\n]*)

Comments:


Extract from a list

Content:

<select name="dropDownList">
  <option value="val1">list choice 1
  <option value="val2" selected>list choice 2
  <option value="val3">list choice 3
</select>

Regex: <select name="dropDownList">(.|\n)*<option value="([^"]*)" selected>([^<\n]*)

Comments:


Home