I have a test file that includes the following code. The page opens up and the first three tests run but the next 3 don’t run. They don’t fail. They just don’t run.
my $sel = Test::WWW::Selenium->new(
host => 'localhost',
port => 4444,
browser => 'firefox',
browser_url => $uri,
singlewindow => 1,
);
$sel->open_ok('/');
$sel->is_element_present_ok('username');
$sel->is_element_present_ok('password');
$sel->is_text_present('Username');
$sel->is_text_present('Password');
$sel->is_text_present('Login');
Then I log into the form.
$sel->type("name=username", $username);
$sel->type("name=password", $password);
$sel->submit('dom=document.forms["formfield"]');
$sel->is_text_present('Change Log');
I’m able to log in and the text ‘Change Log’ is present on the page but the test never runs. The test for text that doesn’t exist doesn’t run either.
$sel->is_text_present('Fee based gumbo');
Anyone know why these tests wouldn’t be running?
I also have a test for a link
<a style="text-decoration:none;" href="/settings">Settings</a>
as
$sel->click('//a[contains(@href, "/settings")]');
That causes the test to crash. Is there a reason why that wouldn’t be found?
EDIT:
I’d been using the WWW::Selenium page, not Test::WWW::Selenium.
This module is a WWW::Selenium subclass providing some methods useful for writing tests. For each Selenium command (open, click, type, …) there is a corresponding <command>_ok method that checks the return value (open_ok, click_ok, type_ok).
The xpath problem $sel->click('//a[contains(@href, "/settings")]'); simply just needed the double quotes removed.
I’d been using the WWW::Selenium page not the Test::WWW::Selenium at http://search.cpan.org/~lukec/Test-WWW-Selenium-1.32/lib/Test/WWW/Selenium.pm
This module is a WWW::Selenium subclass providing some methods useful for writing tests. For each Selenium command (open, click, type, …) there is a corresponding _ok method that checks the return value (open_ok, click_ok, type_ok).
The xpath problem $sel->click(‘//a[contains(@href, “/settings”)]’);
simply just needed the double quotes removed.