perl - WWW::Mechanize::Firefox click button in <div> -
i got big problem. have 12 elements same class - "comment". in every button click.
i need know how select (eg. 3 of 12) , click button there.
is exist selector or something? please give me advice that.
$mech->click can take css selector or xpath query argument. if know button want click always third one, use nth-of-type css selector pinpoint it.
edit: example using xpath based on op's comments (i haven't tested this). use qq
allow variable interpolation inside xpath statement. note have backslash escape occurrences of @
qq
doesn't interpret them arrays:
my $author = 'xxx'; $mech->click({ xpath => qq(//div[\@class="com" , \@author="$author"]/button) });
Comments
Post a Comment