怎么我可以做自动化测试,在非JavaScript应用程序?
-
03-07-2019 - |
题
我写的控制,这项工作很好用JavaScript,但他们的工作甚至没有它。现在测试与硒工作的现我。但是,所有测试的无障碍JavaScript(在我浏览器)不会运行硒。有没有办法做到自动化测试用于这种目的?
解决方案
WWW::机械化 和 测试::WWW::机械化 两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');
其他提示
我不知道Selenium,但使用NoScript Firefox扩展,您可以基于每个域禁用脚本。那么您可以使用它来允许Selenium但禁用页面的脚本吗?
查看其他自动化软件包,例如 TestComplete 或 AutoIt
如果它只是简单的没有javascript的html,你可以使用普通的屏幕抓取技术来比较你从服务器下载的html到你期望的,不需要在浏览器中测试。
您可以使用Watir测试您的Web应用程序。
不隶属于 StackOverflow