Using Javascript | Applescript to click button in Safari

Discussion in 'Web Design and Development' started by o.rka, Jan 30, 2014.

  1. o.rka macrumors newbie

    Joined:
    Jan 30, 2014
    #1
    I realize there are several threads about this and they are all very specific to certain website . My background is in Python, not Javascript or Applescript, and I'm confused on exactly how to achieve this action .



    I've seen several scripts doing this action, namely:

    tell application "Safari"

    activate

    do JavaScript "document.forms['search']['order_list_search_batch'].click()"

    end tell



    Which is the best method to act this out ?

    i'm confused on what goes in between "document.forms[WHATGOESHERE?].click()"



    I'm trying to click the Proceed button on this webpage [http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi]



    [​IMG]



    I went to "Inspect Element" on the Proceed button and got this code:



    <input style="cursor: pointer;" value="" name="proceed" class="proceed" onmouseover="this.style.cursor="pointer"" type="submit">



    How do I know what to put in script to click this button based off of the Inspect Element results ? I want to understand so I can use this method in more than one case . There's not a href link that it goes to . . . please help
     
  2. Code cookies macrumors newbie

    Joined:
    Dec 23, 2011
    Location:
    UK
    #2
    Not sure whether this is what you are looking for, but using jQuery.
    if you wish to do it with other buttons, then just replace .proceed with what ever the class is eg .class

    If the button doesn't have a class eg:

    Then you can use one of the other attributes eg:
     
  3. Code cookies macrumors newbie

    Joined:
    Dec 23, 2011
    Location:
    UK
    #3
    Why have you just copied and pasted the first post??
     
  4. Consultant macrumors G5

    Consultant

    Joined:
    Jun 27, 2007
    #4
    It's a spam bot trying to build up post history. Just report it.
     
  5. Code cookies macrumors newbie

    Joined:
    Dec 23, 2011
    Location:
    UK

Share This Page