tel2 has asked for the wisdom of the Perl Monks concerning the following question:
I haven't used WWW::Mechanize much, and I'm trying to get it to login to a site and make an entry. I can see that the logging on part is working fine, but there's a button that I want to click, and I'm not sure of the cleanest way to do that. Firefox's Firebug shows me that the code behind the button that I want to click looks like this:
What's a clean way to click such a button? As you can see, it doesn't have a "name" attribute, and the "button small" class applies to several buttons on the webpage, so maybe I could click the Nth "button small" (right?), but is there a cleaner way to identify the field? One which won't break if they insert another "button small" above this one, perhaps? There are also several 'type="submit"' buttons on this webpage.<button class="button small" onclick="ga('send','event', 'Add CCL Acti +vity', 'Select', 'Add to Report button in Search Results')" type="sub +mit">Add to Report</button>
I've spent quite some time looking through the documentation and examples, and I can see various ways to click buttons, but nothing stands out as ideal for my situation, so I thought I should ask for expert advice.
Thanks.
tel2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Clicking a button with WWW::Mechanize
by Gangabass (Vicar) on Aug 12, 2014 at 01:33 UTC | |
by tel2 (Pilgrim) on Aug 12, 2014 at 07:43 UTC | |
by tel2 (Pilgrim) on Aug 14, 2014 at 22:19 UTC | |
by Anonymous Monk on Aug 14, 2014 at 22:24 UTC | |
|
Re: Clicking a button with WWW::Mechanize (no javscript)
by Anonymous Monk on Aug 12, 2014 at 01:03 UTC | |
by tel2 (Pilgrim) on Aug 12, 2014 at 05:09 UTC | |
|
Re: Clicking a button with WWW::Mechanize
by tel2 (Pilgrim) on Aug 12, 2014 at 07:42 UTC | |
by choroba (Cardinal) on Aug 12, 2014 at 07:45 UTC | |
by tel2 (Pilgrim) on Aug 12, 2014 at 09:15 UTC |