Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I am a student in biology and have recently started learning perl programming. I have been trying to write a code for my project wherein i need to go to a website search for sequences related to mouse strains and save the data on resulting page in a text file.Earlier i was trying to use Mechanize but then after reading I realized it is not good with javascripts. So i am using WWW::Mechanize::Firefox.

I have added the MozRepl and Firebug addon to firefox. The code seems to run but there is no output at the terminal. I am running it on Ubuntu. I have written the code below. Kindly have a look.

#/usr/bin/perl -w use WWW::Mechanize::Firefox; my $moz = WWW::Mechanize::Firefox->new(); $moz->get($url); $url=' +F'; $form_name1='queryForm'; $strain='availableStrains'; @strvalues=("15","38048","71","25292"); $variation='polymorphismType'; $varvalue='1878510'; $func_class='functionClass'; $funcvalue='1878486'; $output='format'; $outformat='tab'; $moz->get( $url ); $moz->form_name( $form_name1 ); $moz->select($strain,\@strvalues); sleep 1; $moz->click({ xpath => '//*[@value=">>"]' }); $moz->select($variation,$varvalue); $moz->select($func_class,$funcvalue); $moz->set_fields( geneSymname => 'chrnb2' ); $moz->select($output,$outformat); sleep 1; $moz->click_button( value => 'Search' ); ($url2) = $mech -> uri; $content=get($url2); print $content,"\n"; exit;

I have a strong feeling that there is some problem with following part.

$moz->click({ xpath => '//*[@value=">>"]' });

The page source for the above button is:

<INPUT VALUE="&gt;&gt;" onClick="setReference(queryForm.availableStrains, queryForm.referenceStrain);" TYPE="button">

This is my first time on perlmonks and pardon me for such a long question. I am looking forward to replies from fellow monks.

In reply to Question about WWW::Mechanize::Firefox by ssj262

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (7)
    As of 2018-04-24 07:33 GMT
    Find Nodes?
      Voting Booth?