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
Re: using scripting languages to automate a browser [message #180399 is a reply to message #180398] Sun, 10 February 2013 09:03 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 10.02.2013 09:04, schrieb Cal Dershowitz:
> 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/';
--cut--

> 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.

In PHP you would have to issue more or less the same commands/use the same functions.

I think the approach is wrong. Most probably there is a way to encode the whole query
in the url, or there is a API/Service that does what you want.

If the API does not exist, or is too expensive, you could either just provide the
translation link, or you must go through all the "grief", and again when the layout
changes.

/Str.
[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: Sun Nov 03 12:40:36 GMT 2024

Total time taken to generate the page: 0.04283 seconds