1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

javascript newbie question

Discussion in 'HTML & JavaScript' started by wordgeist, Nov 26, 2013.

  1. wordgeist

    wordgeist Regular Member

    Joined:
    May 17, 2011
    Messages:
    387
    Likes Received:
    9
    Hi Guys,

    I have a question for you guys in case you know the answer. Any of you knows how can I get the location x and y of button. let say "I'm feeling lucky" of the google web page. How can I get the location to tell a javascript hey go this location and do a click on that button.

    I'll really appreciate your help.
    Thanks
     
  2. hameem

    hameem Elite Member

    Joined:
    Jul 21, 2011
    Messages:
    1,884
    Likes Received:
    987
    Location:
    221B Baker Street
    I'm not 100% sure but this might work with JQuery

    $('#element').position()
     
  3. wordgeist

    wordgeist Regular Member

    Joined:
    May 17, 2011
    Messages:
    387
    Likes Received:
    9
    I forgot to mention the script is not part of the webpage. I'm building a javascript automation tool.
     
  4. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,530
    Likes Received:
    10,673
    Occupation:
    Full-time Knitter
    Location:
    Buenos Aires
    And how are you going to have the tool "view" the DOM without browser emulation? Position requires the DOM, not just scraping the html output.