Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow content file/callback and read size hint in click and click_button #224

Open
spazm opened this issue May 8, 2017 · 0 comments
Open

Comments

@spazm
Copy link
Contributor

spazm commented May 8, 2017

[email protected] reported on May 9, 2013

What version of the product are you using? On what operating system?
1.72_02

Would be nice if click() and click_button() could pass on the content_file/callback and/or read_size_hint to the request() method:

Suggested changes:

sub click {
    my ($self, $button, $x, $y, @args) = @_;
    for ($x, $y) { $_ = 1 unless defined; }
    my $request = $self->current_form->click($button, $x, $y);
    return $self->request( $request, @args );
}

sub click_button {
    my $self = shift;
    my %args = @_;

    for ( keys %args ) {
        if ( !/^(number|name|value|input|x|y)$/ ) {
            $self->warn( qq{Unknown click_button parameter "$_"} );
        }
    }

    for ($args{x}, $args{y}) {
        $_ = 1 unless defined;
    }

    my $form = $self->current_form or $self->die( 'click_button: No form has been selected' );

    my $request;
    if ( $args{name} ) {
        $request = $form->click( $args{name}, $args{x}, $args{y} );
    }
    elsif ( $args{number} ) {
        my $input = $form->find_input( undef, 'submit', $args{number} );
        $request = $input->click( $form, $args{x}, $args{y} );
    }
    elsif ( $args{input} ) {
        $request = $args{input}->click( $form, $args{x}, $args{y} );
    }
    elsif ( $args{value} ) {
        my $i = 1;
        while ( my $input = $form->find_input(undef, 'submit', $i) ) {
            if ( $args{value} && ($args{value} eq $input->value) ) {
                $request = $input->click( $form, $args{x}, $args{y} );
                last;
            }
            $i++;
        } # while
    } # $args{value}

    return $self->request(
        $request,
        $args{content_file} || $args{content_cb},
        $args{read_size_hint},
    );
}

Details

Imported from Google Code issue 247 via archive

  • Type: Defect
  • Date: May 9, 2013
  • Reporter: [email protected]
  • Owner: ----
  • Priority: Medium
  • Status: New
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant