Permalink
Browse files

Added extra test for converting WebElements when Arrays are returned

  • Loading branch information...
1 parent af73bce commit db7380ad46b96f932501524988c1f0df6af1e699 @Swandog committed Mar 1, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 t/01-driver.t
View
@@ -177,6 +177,20 @@ EXECUTE: {
my $elem = $driver->execute_script($script,'checky');
ok($elem->isa('Selenium::Remote::WebElement'), 'Executed script');
is($elem->get_attribute('id'),'checky','Execute found proper element');
+ $script = q{
+ var links = window.document.links
+ var length = links.length
+ var results = new Array(length)
+ while(length--) results[length] = links[length];
+ return results;
+ };
+ $elem = $driver->execute_script($script);
+ ok($elem, 'Got something back from execute_script');
+ isa_ok($elem, 'ARRAY', 'What we got back is an ARRAY ref');
+ ok(scalar(@$elem), 'There are elements in our array ref');
+ foreach my $element (@$elem) {
+ isa_ok($elem, 'Selenium::Remote::WebElement', 'Element was converted to a WebElement object');
+ }
$script = q{
var arg1 = arguments[0];
var callback = arguments[arguments.length-1];

0 comments on commit db7380a

Please sign in to comment.