Safari.pm 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package Selenium::Driver::Safari;
  2. use strict;
  3. use warnings;
  4. no warnings 'experimental';
  5. use feature qw/signatures/;
  6. use Carp qw{confess};
  7. use File::Which;
  8. #ABSTRACT: Tell Selenium::Client how to spawn safaridriver
  9. =head1 Mode of Operation
  10. Spawns a geckodriver server on the provided port (which the caller will assign randomly)
  11. Relies on geckodriver being in your $PATH
  12. Pipes log output to ~/.selenium/perl-client/$port.log
  13. =head1 SUBROUTINES
  14. =head2 build_spawn_opts($class,$object)
  15. Builds a command string which can run the driver binary.
  16. All driver classes must build this.
  17. =cut
  18. sub build_spawn_opts($class,$object) {
  19. $object->{driver_class} = $class;
  20. $object->{driver_version} //= '';
  21. $object->{log_file} //= "$object->{client_dir}/perl-client/selenium-$object->{port}.log";
  22. $object->{driver_file} = File::Which::which('safaridriver');
  23. my @config = ('--port', $object->{port});
  24. # Build command string
  25. $object->{command} //= [
  26. $object->{driver_file},
  27. @config,
  28. ];
  29. return $object;
  30. }
  31. 1;