Re: trouble with SELECT inputs in WWW::Mechanize

2003-12-19 Thread Jim Martinez
On Dec 15 Jim Martinez wrote:

 On Dec 13 Andy Lester wrote:
  I'm glad to see you usin' Mech for testing.  My two favorite hats:
  Testing and Mech!
 Trying to wear those two hats, I replaced the SELECT ...  
 multiple='multiple' with checkboxes and had problems.

  Yes, that is a shortcoming of Mech.  I'm going to try to fix it this

I left the SELECT multiple=multiple and when to checkboxes.

The checkbox problem was not really a problem.  I just was mixing
Test::More and WWW::Mechanize incorrectly.

A sample of what I tried (that didn't work):

ok($a-tick(city = '109'), set city to 109); # always not ok
ok($a-click('submit'),click the done button);

what works:

$a-tick(city = '109');
# and many other ticks done here
ok($a-click('submit'),click the done button);

In other words, the -tick shouldn't be inside of ok.  Instead I now do
all the -ticks that I want (with no ok) and then do an ok on the -click

 So I ran the tick.t script that comes with WWW::Mechanize which had
 problems, claiming there is nor form number 1, but I see one in the
 tick.html file.

I think that was just an environment problem, and my escapist mind trying
to figure out what was wrong.  The tick.t works fine when I run a make

WWW::Mechanize is working out just fine.

 [EMAIL PROTECTED] t]$ perl tick.t
 ok 1 - use WWW::Mechanize;
 ok 2 - The object isa WWW::Mechanize
 ok 3 - URI shouldn't be an object
 not ok 4 - file:/home/jjm/.cpan/build/WWW-Mechanize-0.70/t/t/tick.html
 # Failed test (tick.t at line 15)
 There is no form numbered 1 at tick.t line 17
 Can't call method find_input on an undefined value at 
 /usr/lib/perl5/site_perl/5.6.1/WWW/ line 597.
 # Looks like you planned 6 tests but only ran 4.
 # Looks like your test died just after 4.


trouble with SELECT inputs in WWW::Mechanize

2003-12-13 Thread Jim Martinez

In the testing script below I can't seem to set values in a multiple
select list with WWW::Mechanize.

I tired several different methods of setting the fields but none have

In the form below you should be able to select one or more city and one or
more county.  After removing the multiple option in the county select, I
was able to set the field (ie test 4 started working).

Thanks in advance for any advice, or suggestions.

Here is the test script (with the actual url replaced with localhost):

use strict;
use Test::More;
use WWW::Mechanize;

BEGIN { plan tests = 5}
my $url=qq|http://localhost/test1.html|;

ok(my $a = WWW::Mechanize-new(),create browser);
is($a-status,200,get initial page ($url));
ok($a-form_number('1')  ,select query form);
ok($a-field('county_all'=1),set county_all to 1);
#print contents:,$a-content,\n;

ok($a-field('nid' = '106'),set nid to 106);

And here is the html file test1.html :

!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html lang=en
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
form method=get action=http://localhost/summary/;
pPick one or more city/p
select name=nid size=6 multiple=multiple
   option  value=106foo city/option
   option  value=199bar city/option

pPick a county/p
!-- select name=county_all size=6 multiple=multiple --
select name=county_all size=6
  option value=1Bay/option
  option value=2Washington/option
input type=submit name=done value=done
input type=hidden name=action value=get_indicators


Here is the output of my testing script listed above:

ok 1 - create browser
ok 2 - get initial page (http://localhost/test1.html)
ok 3 - select query form
ok 4 - set county_all to 1
not ok 5 - set nid to 106
# Failed test ( at line 20)
# Looks like you failed 1 tests of 5.

An archive search shows someone (ask) asking a similar question about
HTML::Form but the single response didn't make sense to me.

trouble with SELECT inputs in HTML::Form[EMAIL PROTECTED]/msg04154.html