in reply to Re^4: How to control two tabs at the same time with WWW::Mechanize::Firefox
in thread How to control two tabs at the same time with WWW::Mechanize::Firefox

->is_visible expects your XPath expression to find 0 or 1 element, not more. If you know that there will be zero or multiple elements, you can restrict your XPath expression by using an index:

//a[@class="kl"][1]

Replies are listed 'Best First'.
Re^6: How to control two tabs at the same time with WWW::Mechanize::Firefox
by mascip (Pilgrim) on Mar 12, 2012 at 00:00 UTC

    It doesn't work if i use

    xpath => '//a[@class="kl"][1]'
    (i get exactly the same error).
    But it works when i use
    xpath => '//input[@class="gbqfif"]'
    which is a unique element in the page.
    The result is perfect : 2 seconds or less instead of 5 or 6! Thank you so much!

    I hope you're having good times :o)

Re^6: How to control two tabs at the same time with WWW::Mechanize::Firefox
by mascip (Pilgrim) on Mar 12, 2012 at 12:02 UTC

    PS: i forgot to say yesterday that in the cookbook (here) the code is (slighly) broken:
    When $retries reaches 0, then it becomes equal to -1 and the "Timeout" exception is not triggered.
    It's just a detail, but i thought it might help others if it was fixed : i waited for 10 seconds many times before realizing that is was not the page charging, but just a Timeout.