MockCommands.pm 882 B

12345678910111213141516171819202122232425262728293031323334
  1. package 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 = delete $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. $data->{'url_params'} = $args;
  14. return $data;
  15. }
  16. sub get_method_name_from_parameters {
  17. my $self = shift;
  18. my $params = shift;
  19. my $method_name = '';
  20. my $cmds = $self->get_cmds();
  21. foreach my $cmd (keys %{$cmds}) {
  22. if (($cmds->{$cmd}->{method} eq $params->{method}) && ($cmds->{$cmd}->{url} eq $params->{url})) {
  23. $method_name = $cmd;
  24. last;
  25. }
  26. }
  27. return $method_name;
  28. }
  29. 1;