WinApp.pm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package Selenium::Driver::WinApp;
  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 the Windows Application Driver
  9. =head1 Mode of Operation
  10. Spawns a WinAppDriver server on the provided port (which the caller will assign randomly)
  11. Relies on WinAppDriver being in your $PATH (put in this to your user's PATH env var:)
  12. %PROGRAMFILES(X86)%\Windows Application Driver
  13. Pipes log output to ~/.selenium/perl-client/$port.log
  14. =head1 SUBROUTINES
  15. =head2 build_spawn_opts($class,$object)
  16. Builds a command string which can run the driver binary.
  17. All driver classes must build this.
  18. =cut
  19. sub _driver {
  20. return 'WinAppDriver.exe';
  21. }
  22. sub build_spawn_opts($class,$object) {
  23. $object->{driver_class} = $class;
  24. $object->{driver_version} //= '';
  25. $object->{log_file} //= "$object->{client_dir}/perl-client/selenium-$object->{port}.log";
  26. $object->{driver_file} = File::Which::which($class->_driver());
  27. die "Could not find driver!" unless $object->{driver_file};
  28. #XXX appears that escaping from system() does not work correctly on win32 thanks to the join() I have? to do later, sigh
  29. $object->{driver_file} = qq/"$object->{driver_file}"/;
  30. my @config = ($object->{port});
  31. # Build command string
  32. $object->{command} //= [
  33. $object->{driver_file},
  34. @config,
  35. ];
  36. return $object;
  37. }
  38. 1;