I got a big problem. I have 12 elements with the same class - "comment". In every is button to click.
I need to know how to select (eg. 3 of 12) and click button only there.
Is exist any selector or something? Please give me some advice about that.
$mech->click can take a CSS selector or an XPath query as an argument. If you know that the button you want to click will always be the third one, you could use something like the nth-of-type CSS selector to pinpoint it.
EDIT: An example using XPath based on the OP's comments (I haven't tested this). Use
qq
to allow variable interpolation inside the XPath statement. Note that you have to backslash escape occurrences of@
soqq
doesn't interpret them as arrays: