Reputation:
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?
Upvotes: 4
Views: 538
Reputation: 164639
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');
Upvotes: 1
Reputation: 3328
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.
Upvotes: 0
Reputation:
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?
Upvotes: 2