MockCommands.pm 857 B

123456789101112131415161718192021222324252627282930313233
  1. package Selenium::Remote::MockCommands;
  2. use Moo;
  3. extends 'Selenium::Remote::Commands';
  4. # override get_params so we do not rewrite the parameters
  5. sub get_params {
  6. my $self = shift;
  7. my $args = shift;
  8. my $data = {};
  9. my $command = $args->{command};
  10. $data->{'url'} = $self->get_url($command);
  11. $data->{'method'} = $self->get_method($command);
  12. $data->{'no_content_success'} = $self->get_no_content_success($command);
  13. return $data;
  14. }
  15. sub get_method_name_from_parameters {
  16. my $self = shift;
  17. my $params = shift;
  18. my $method_name = '';
  19. my $cmds = $self->get_cmds();
  20. foreach my $cmd (keys %{$cmds}) {
  21. if (($cmds->{$cmd}->{method} eq $params->{method}) && ($cmds->{$cmd}->{url} eq $params->{url})) {
  22. $method_name = $cmd;
  23. last;
  24. }
  25. }
  26. return $method_name;
  27. }
  28. 1;