firefox.test 678 B

12345678910111213141516171819202122232425262728
  1. use strict;
  2. use warnings;
  3. use Selenium::Firefox;
  4. use Test::More tests => 4;
  5. use Test::Fatal;
  6. my $driver;
  7. is( exception { $driver = Selenium::Firefox->new(
  8. extra_capabilities => {
  9. 'moz:firefoxOptions' => {
  10. args => [ '-headless' ],
  11. },
  12. },
  13. ); }, undef, "can spawn new Selenium::Firefox");
  14. my $port = $driver->port();
  15. ok($driver->get('http://google.com'),"can load a page");
  16. $driver->quit();
  17. is( exception { $driver->shutdown_binary; }, undef, "can shutdown binary correctly");
  18. sleep 2;
  19. my $cmd = "lsof -t -i :$port";
  20. my $pid = `$cmd`;
  21. chomp $pid;
  22. is($pid,'',"Destructor appears to have run shutdown_binary and whacked the driver process");