Question

I am writing controls that work nice with JavaScript, but they have to work even without it. Now testing with selenium works fine for me. But all test with disabled JavaScript (in my browser) won't run with selenium. Is there a way to do automated test for this purpose?

Was it helpful?

Solution

WWW::Mechanize and Test::WWW::Mechanize are two Perl modules to do exactly that.

use Test::More tests => 5;
use Test::WWW::Mechanize;

my $mech = Test::WWW::Mechanize->new;

# Test you can get http://petdance.com
$mech->get_ok( "http://petdance.com" );

# Test the <BASE> tag
$mech->base_is( 'http://petdance.com/', 'Proper <BASE HREF>' );

# Test the <TITLE>
$mech->title_is( "Invoice Status", "Make sure we're on the invoice page" );

# Test the text of the page contains "Andy Lester"
$mech->content_contains( "Andy Lester", "My name somewhere" );

# Test that all links on the page succeed.
$mech->page_links_ok('Check all links');

OTHER TIPS

I don't know Selenium, but with the NoScript Firefox extension, you can disable scripts on a per-domain basis. So could you use that to allow Selenium but disable your page's scripts?

Check out other automation packages such as TestComplete or AutoIt

If it's just plain html with no javascript, you could just use normal screenscraping techniques to compare the html you downloaded from the server to what you expect, no need to test in a browser.

You could use Watir to test your web application.

http://wtr.rubyforge.org/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top