[Webtest] Strange behaviour with PHP???

Randall Dietz webtest@lists.canoo.com
Sun, 08 Jun 2003 13:28:37 +1000


G'day all,

I have a PHP application and in theory, WebTest shouldn't care... right?
Well, I'm not convinced because I'm experiencing a very strange problem with
"setselectfield" and I hope someone can make sense of all this.

I am dynamically generaing a list of options in a select box in PHP as
follows:

        print "<select name=\"id\">\n";
        for ($i = 0; $row = $galleries[$i]; $i++) {
            print '<option value="' . $row['id'] . '">' . $row['title'] .
"</option>\n";
        }
        print "<option value=\"0\">All Galleries</option>\n";
        print "<option value=\"9\">TEST</option>\n";
        print '</select>';

When invoked by a browser, the following HTML code is created (as per "view
source"):

<select name="id">
<option value="1">Gallery 1</option>
<option value="2">Gallery 2</option>
<option value="0">All Galleries</option>
<option value="9">TEST</option>
</select>

The page works fine... but when I run the following setselectfield task in
my web tests script:

      <setselectfield stepid="Select Art Gallery" name="id"  value="2" />

I get the following error:  May not set parameter 'id' to '2'. Value must be
one of: { 0,9 }

You've guessed it... I've tested this extensively and any options printed
*within* the for loop are not recognised by WebTest.  Any options *outside*
the for loop are recognised.  Does this make sense to anyone?  I'm running
PHP 4.3.1 off Apache 2.

BTW - using the "text=" attribute works the same.

cheers -- Randall