4

我正在编写与 JavaScript 配合得很好的控件,但即使没有它,它们也必须工作。现在用硒进行测试对我来说很好。但是所有使用禁用 JavaScript(在我的浏览器中)的测试都不会使用 selenium 运行。有没有办法为此目的进行自动化测试?

4

5 回答 5

2

我不知道 Selenium,但是使用 NoScript Firefox 扩展,您可以在每个域的基础上禁用脚本。那么您可以使用它来允许 Selenium 但禁用您页面的脚本吗?

于 2008-10-17T10:59:43.500 回答
1

查看其他自动化软件包,例如TestCompleteAutoIt

于 2008-10-17T11:09:46.130 回答
1

WWW::MechanizeTest::WWW::Mechanize是两个 Perl 模块,可以做到这一点。

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');
于 2008-10-18T08:09:12.017 回答
0

如果它只是没有 javascript 的纯 html,您可以使用普通的屏幕抓取技术来比较您从服务器下载的 html 与您期望的内容,无需在浏览器中进行测试。

于 2008-10-17T11:18:03.807 回答
0

您可以使用 Watir 来测试您的 Web 应用程序。

http://wtr.rubyforge.org/

于 2008-10-18T19:38:25.803 回答