How to catch 404 errors in Selenium using Perl? -
i have perl script uses selenium fetch html document called foo doesn't exist (404 not found.) default behavior script print error , terminate, such "bar" never printed. i'm looking way continue on instead, such "bar" printed.
here's i've got. code (called foo.pl):
#!/usr/bin/perl use strict; use www::selenium; $sel = www::selenium->new( host => "localhost", port => 4444, browser => "*chrome", browser_url => "http://www.google.com/" ); $sel->start; $sel->open("http://www.google.com/foo.html") print "bar";
here's message printed:
error requesting http://localhost:4444/selenium-server/driver/?cmd=open&1=http%3a%2f%2fwww.google.com%2ffoo.html&sessionid=bc9c086eef804a7c8a0090674333e4c7: xhr error: url = http://www.google.com/foo.html response_code = 404 error_message = not found
i've looked over, haven't found answer this. thanks!
i'm not sure of implementation in perl, in java, selenium-rc has traffic capture mode, defined selenium.start("capturenetworktraffic=true");
enable capture http responses, including error codes. once error code retrieved, can resume execution...
here excellent resource on how capture , process/format information once retrieved. uses python, though, should give start.
Comments
Post a Comment