FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » using scripting languages to automate a browser
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
using scripting languages to automate a browser [message #180398] Sun, 10 February 2013 08:04 Go to previous message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma:
Member
Hello newsgroup,

I've been trying to use perl to automate processes that aren't much more
than a few GUI events that a person would do if he had a browser.

#!/usr/bin/perl -w
use strict;
use autodie;
use utf8;
use WWW::Mechanize;

my $url = 'http://translate.google.com/';
my $mech = WWW::Mechanize->new;
my $result = $mech->get($url);
die "GET failedn" unless $result->is_success;


my $filename = 'content1.txt';
$mech->save_content($filename);


my @links = $mech->links();
print "tags\n";
print $_->tag()."\n" foreach @links;
print "URI\n";
print $_->URI()."\n" foreach @links;
print "text\n";
print $_->text()."\n" foreach @links;
print "forms\n";
my @forms = $mech->forms();
# print $_->text()."\n" foreach @forms;
$mech->current_form()

With the amount of difficulty that this has presented itself to be, I've
started to wonder whether I'm not using a wrench to pound a nail. What
I'm trying to do in this instance is to click a button to turn the
language, enter the text that I would have in a file, click translate,
and capture the output.

Is this something that php can do in a way that involves less grief?

Thanks for your comment, and cheers.
--
Cal Dershowitz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CMS Recommendation
Next Topic: On click button in php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 04:06:50 GMT 2024

Total time taken to generate the page: 0.05433 seconds