Я пытаюсь использовать 'Test :: WWW :: Selenium :: More' и 'Moose', создавая свой собственный класс под названием 'MySelenium' в Perl.Тест :: WWW :: Selenium :: Больше с Moose
Это ошибка Moose при запуске программы:
You must pass an even number of attribute options at /Library/Perl/5.18 /darwin-thread-multi-2level/Moose/Exporter.pm line 422
Moose::has('host', 'localhost') called at MySelenium.pm line 5
require MySelenium.pm at x.pl line 5
main::BEGIN at MySelenium.pm line 0
eval {...} at MySelenium.pm line 0
Compilation failed in require at ./x.pl line 5, <DATA> line 438.
BEGIN failed--compilation aborted at ./x.pl line 5, <DATA> line 438.
Вот программа:
#!/usr/bin/perl -w
use strict;
use MySelenium;
use Test::Most;
my $x = MySelenium->new;
$x->open_ok('/');
done_testing;
Вот мой класс называется 'MySelenium'
package MySelenium;
use Moose;
extends 'Test::WWW::Selenium::More';
has host => 'localhost';
has port => 4444;
has browser => 'firefox';
has browser_url => (is => 'rw', isa => 'Str',
default => 'http://www.google.com');
sub login_ok {
my ($self, $username, $password) = @_;
$self->open_ok('/login');
$self->is_text_present_ok('Please login thanks');
$self->type_ok('username' => $username);
$self->type_ok('password' => $password);
$self->follow_link_ok('login');
}
no Moose;
Любой помощь будет принята с благодарностью.