Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 30, 2014, 02:24 PM   #1
o.rka
macrumors newbie
 
Join Date: Jan 2014
Using Javascript | Applescript to click button in Safari

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]







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=&quot;pointer&quot;" 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
o.rka is offline   0 Reply With Quote
Old Feb 1, 2014, 04:34 AM   #2
Code cookies
macrumors newbie
 
Join Date: Dec 2011
Location: UK
Not sure whether this is what you are looking for, but using jQuery.
Quote:
$(".proceed").click();
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:

Quote:
<input style="cursor: pointer;" value="" name="proceed" onmouseover="this.style.cursor=&quot;pointer&quot;" type="submit">
Then you can use one of the other attributes eg:
Quote:
$("input[name='proceed']").click();
Code cookies is offline   0 Reply With Quote
Old Feb 17, 2014, 01:49 PM   #3
Code cookies
macrumors newbie
 
Join Date: Dec 2011
Location: UK
Why have you just copied and pasted the first post??
Code cookies is offline   0 Reply With Quote
Old Feb 17, 2014, 03:54 PM   #4
Consultant
macrumors G5
 
Consultant's Avatar
 
Join Date: Jun 2007
Quote:
Originally Posted by Code cookies View Post
Why have you just copied and pasted the first post??
It's a spam bot trying to build up post history. Just report it.
Consultant is offline   0 Reply With Quote
Old Feb 18, 2014, 04:15 PM   #5
Code cookies
macrumors newbie
 
Join Date: Dec 2011
Location: UK
Ok thanks a lot
Code cookies is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Applescript Javascript OSA, other recommended OSAXen macmesser Mac Programming 4 Mar 5, 2014 02:00 PM
Applescript Safari how to click button redwgaontoy Mac Programming 1 Jun 11, 2013 11:12 PM
Safari 6 back/forward button, right-click shows sites visited? Temaki OS X 10.8 Mountain Lion 3 Aug 14, 2012 11:15 AM
AppleScript To Click One Button Only If Another Button Is Unavailable JonHimself Mac Programming 2 Jul 4, 2012 12:16 PM

Forum Jump

All times are GMT -5. The time now is 05:42 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC