views:

171

answers:

5

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?

+2  A: 

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?

Selenium works by using Javascript to interact with the webpage. That means if you turn off Javascript, Selenium can't run.
Alan Storm
+1  A: 

Check out other automation packages such as TestComplete or AutoIt

Shane MacLaughlin
A: 

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.

A: 

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');
Schwern
A: 

You could use Watir to test your web application.

http://wtr.rubyforge.org/

Željko Filipin