Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Selenium Click with x and y coordinates

by arya6000 (Novice)
on Sep 17, 2009 at 03:06 UTC ( [id://795758]=perlquestion: print w/replies, xml ) Need Help??

arya6000 has asked for the wisdom of the Perl Monks concerning the following question:

Hello

I'm trying out Selenium for the first time and on one of the pages there is a javascript button that I want to click using x and y coordinates. I read the documentation on this link http://search.cpan.org/~lukec/Test-WWW-Selenium-1.18/lib/WWW/Selenium.pm but did not figure out how to give it x and y coordinates, in the examples it says to use the following method if you want to click x and y coordinates.
$sel->click_at($locator, $coord_string)
In the example above, it says to give it a locator and coord_string. Is there anyway to give it only the coordinates?

Best Regards

Replies are listed 'Best First'.
Re: Selenium Click with x and y coordinates
by jandrew (Chaplain) on Sep 17, 2009 at 14:59 UTC
    I prefer to click on the button by it's Document Object Model "DOM" id and then you are not locked into the location on the screen.

    $sel->click ( "id=button1" )
    or walk the DOM tree
    $sel-> click ( 'dom=document.getElementById( "11" ).parentNode.firstChild.firstChild' )
Re: Selenium Click with x and y coordinates
by venkatesan_G02 (Sexton) on Sep 17, 2009 at 10:55 UTC
    Have you installed Selenium IDE in your firefox?
Re: Selenium Click with x and y coordinates
by jandrew (Chaplain) on Sep 17, 2009 at 19:02 UTC
    At the risk of answering in an XY Problem way I read you earlier post about Win32::IEAutomation. Having recently gone through my own dail-up on Selenium and to reinforce what venkatesan_G02 implied, IE is buggy when using Selenium. As long as your only goal is to automate access to a web page you're better off sticking with automating a Firefox browser since the DOM inspector support is better and IE fails to respond to Selenium in weird ways.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://795758]
Approved by AnomalousMonk
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-23 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found