On 2010.10.12 4:56 PM, Max Maischein via RT wrote:
Show quoted text> Yes. Pass
>
> synchronize => 0
>
> when making the ->click() call. ->follow_link() does not support that
> yet, but that should be implemented there as well, if the API allows for it.
>
> $mech->click({ xpath => '//a[ contains( text(), "Preferences") ]},
> synchronize => 0 );
>
> Unfortunately, XPath doesn't allow for regular expressions, so you'll
> have to do with substring matches...
Thanks for the quick response! This worked:
$mech->get("
http://www.google.com");
$mech->click({
xpath => q{//div[@id='guser']//a[@class='gb3']},
synchronize => 0
});
I need to click on a very specific link which is difficult to specify with an
xpath. In this case there are sets of very similar links and I only care
about the visible ones. Its the "Web | Yellowbook | eBay" links at the top of
http://charter.net/
my @buttons = grep { $mech->is_visible($_) }
$mech->xpath(q{//div[@class="search_cat"]//a});
$mech->follow_link($buttons[1]);
click() can't do this, as documented, but I dug into the code and discovered
the undocumented "dom" option which worked.
my @buttons = grep { $mech->is_visible($_) }
$mech->xpath(q{//div[@class="search_cat"]//a});
$mech->click({ dom => $buttons[1], synchronize => 0 });
Its handy! Should it be documented?
--
101. I am not allowed to mount a bayonet on a crew-served weapon.
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
http://skippyslist.com/list/