'no form has been selected' error after button click

48 views
Skip to first unread message

mcco...@molbio.mgh.harvard.edu

unread,
Aug 26, 2015, 1:12:02 AM8/26/15
to WWW::Mechanize users
I am using www::Mechanize to go to a URL:
$mech->get( "http://ppsp.biocuckoo.org/");

input text to text box:
my $name = "eppSeq";
my $value = ">gi|1621261
MGAAGDAAIGRESRELMSAAD";
$mech->field($name, $value);


select an option,
my $name2 = "KinasesLeft";
my $value2 = "3";
$mech->select($name2, $value2);


click on a button to choose the option:
$mech->click_button( name => "topLeft2Right");

then click a submit button:
$mech->click_button( name => "submit");

Everything is successful up until the last click_button, using $mech->success() all returns are 1 after each step up to the submit button. However, I get an error: click_button: No form has been selected at line indicating where the $mech->click_button( name => "submit") command is located. 

Does the form change after clicking a button ? 

If I comment-out the first 'click_button' command, then all seems to work.

The first click_button is an arrow button that takes what has been selected in one text box and moves it over to another text box. It is the top button in the middle between the two text boxes on the figure below. Highlighted in yellow.
 


Matthew

Andy Lester

unread,
Aug 26, 2015, 1:17:03 AM8/26/15
to www-mecha...@googlegroups.com

On Aug 25, 2015, at 10:25 PM, mcco...@molbio.mgh.harvard.edu wrote:

> click on a button to choose the option:
> $mech->click_button( name => "topLeft2Right");
>
> then click a submit button:
> $mech->click_button( name => "submit");
>
> Everything is successful up until the last click_button, using $mech->success() all returns are 1 after each step up to the submit button. However, I get an error:click_button: No form has been selected at line indicating where the $mech->click_button( name => "submit") command is located.
>
> Does the form change after clicking a button ?

->click_button() is a shorthand way of calling ->submit_form().

It looks like when you click that first button, it does some JavaScript. Mech doesn't know anything about JavaScript, so button actions that do JavaScript won't work in Mech.

--
Andy Lester => www.petdance.com

Daniel de Oliveira Mantovani

unread,
Aug 26, 2015, 9:03:47 AM8/26/15
to www-mecha...@googlegroups.com
You can use Google Chrome/Firefox Inspector and get the javascript form informations and do manually. It is pretty simple, https://developer.chrome.com/devtools/docs/network

Thank you.


--
You received this message because you are subscribed to the Google Groups "WWW::Mechanize users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to www-mechanize-u...@googlegroups.com.
To post to this group, send email to www-mecha...@googlegroups.com.
Visit this group at http://groups.google.com/group/www-mechanize-users.
For more options, visit https://groups.google.com/d/optout.



--

-dom

--

Daniel de Oliveira Mantovani
Business Analytic Specialist
Perl Evangelist /Astrophysics hobbyist.
+55 11 9 8538-9897
XOXO
Reply all
Reply to author
Forward
0 new messages