Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl and Selenium Grid 2 - Redirecting STDOUT not working how I need it to.

by marquezc329 (Scribe)
on Nov 20, 2012 at 15:55 UTC ( #1004745=note: print w/ replies, xml ) Need Help??


in reply to Perl and Selenium Grid 2 - Redirecting STDOUT not working how I need it to.

hello Doozer,

Not a solution, but I rewrote the beginning of your script using a hash to avoid having to test before $hostname assignment. Loop variables probably shouldn't be declared globally either. Anyways, here's what I came up with.

#!/usr/bin/perl use strict; use warnings; my %hosts = ( "192.168.1.206" => "Windows_XP", "192.168.1.207" => "Windows_Vista", "192.168.1.208" => "Windows_7", "192.168.1.230" => "MAC_OSX_Mountain_Lion", "192.168.1.231" => "MAC_OSX_Lion" ); my @browsers = qw/ firefox googlechrome iexplore /; my $browserurl = 'http://admin:sky@192.168.0.1/'; my $date = (localtime); foreach my $browser (@browsers) { foreach my $host (keys %hosts) { my $sel = Test::WWW::Selenium->new(host => "$host", port => 5555, browser => $browser, browser_url => "http://192. +168.0.1" ); my $hostname = $hosts{$host}; open STDOUT, "+>/varwww/cgi-bin/Perl-Scripts/$hostname\_$brows +er\.txt" or die "Failed to open $hostname\_$browser.txt: $!\n"; print "$host - $hostname - $browser - $date\n\n"; } }

Happy Tuesday.


Comment on Re: Perl and Selenium Grid 2 - Redirecting STDOUT not working how I need it to.
Select or Download Code
Re^2: Perl and Selenium Grid 2 - Redirecting STDOUT not working how I need it to.
by Doozer (Beadle) on Nov 20, 2012 at 16:03 UTC
    Thanks! I really appreciate you taking the time to do that and I will definitely look at using it in my script to make things neater.

    On another note, I actually solved my problem with a lucky find on Google instigated by tye's last comment. The package Test::More has a function where test output can be redirected to any file I like and can be split apart just like STDOUT and STDERR. Thanks for the input you all have already made and if there are any more suggestions to streamline the script I would welcome them!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004745]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-09-16 16:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (34 votes), past polls