Click a button in Safari using Applescript

Hi,
I've been dabbling in Applescript for the last few weeks and while I can make it perform some pretty complex workflows, I still have virtually no knowledge of how to make it interact with JavaScript, and it's an essencial part of a new, larger applescript I'm working on  to streamline a mundane task I'll need to perform a few hundred times.
In particular, with the page "https://www.google.com/doubleclick/studio/swiffy/" already opened in Safari, I'd like  AppleScript to:
1) Click the "Browse" button.
2) Browse to find the file in question (FilePath)
3) Check the Checkbox.
4) Then click the "Upload and convert" button to start the conversion.
Could anyone tell me how to interact with these buttons? I'd appreciate specific solutions, since i can make neither head nor tails of JavaScript.
Cheers!

Hi again,
since I still haven't found the solution to the problem, I've tried to find some answers on my own. I've tried to use .getElementById function, but it only works for the little checkbox on the page, since I can't get the IDs for the other elements. This is how much working code I've come up with so far:
tell application "Safari"
    activate
    set URL of document 1 to "https://www.google.com/doubleclick/studio/swiffy/"
    delay 4
    do JavaScript "document.getElementById('gwt-uid-13').click()" in document 1
    delay 1
end tell
The problem is, I don't think the other elements have IDs. So, after some research I found that you should be able to manipulate them with other functions such as, getElementsByTagName, but it didn't work for me. I added the following line to the script:
do JavaScript "document.getElementById('gwt-uid-13').click()" in document 1
but it does nothing.
Below you can find the two elements as they embedded in the page:
First Element to open the file finder info to upload the file:
<form target=​"FormPanel_SwiffyFrontend_1" enctype=​"multipart/​form-data" method=​"post" action=​"/​doubleclick/​studio/​swiffy/​upload">​<table cellspacing=​"0" cellpadding=​"0">​<tbody>​<tr>​<td align=​"left" style=​"vertical-align:​ top;​ ">​<input type=​"file" class=​"gwt-FileUpload" name=​"swfFile">​
Second Element to submit the file:
<td align=​"left" style=​"vertical-align:​ top;​ ">​<table cellspacing=​"0" cellpadding=​"0">​<tbody>​<tr>​<td align=​"left" style=​"vertical-align:​ top;​ ">​<button type=​"submit" class=​"gwt-SubmitButton">​Upload and convert​</button>​
I'm really desperate for some help here. I just don't understand what I'm supposed to do. More specific and less general solutions would be very much appreciated.
Cheers!

Similar Messages

  • Click a button in Safari

    I want to locate a button on a web page and click it. That's it. Sounds easy but I don't how to locate the button.
    I can't link to the web page because you need to be a member to view it. I also want to learn from this so I can locate a button on a different page in the future.
    I tried UI Element inspector but didn't see the info for the button when I hovered over it. Well it gave me info I'm not sure what I'm looking for though.
    I found the name of the button in the source for the page if there is a way to take that rout.
    Thanks

    Safari button are notoriously hard to pin down. Get UIElement Inspector active and while hovering above the button in question press Cmd-F10. This will freeze the Inspector window. Then post the lines from the Inspector window up to 'Attributes:'. They should look similar to this:
    <AXApplication: “Safari”>
    <AXWindow: “Apple - Support - Discussions - Click a button in Safari ...”>
    <AXGroup>
    <AXScrollArea>
    <AXWebArea: “”>
    <AXGroup: “”>
    <AXLink: “Point your RSS reader here for a feed of the latest messages in this topic”>
    I should then be able to give you a starting point for AppleScript.

  • Can't click on buttons in Safari ???

    When I use Safari (5.0.5) I sometimes can't click on buttons on websites... For example I can't click on the "Search" button in Google or the "Login" button on Facebook. When I click the buttons nothing happens! I have tried to reset Safari but it doesn 't help.
    The problem can only be solved by restarting my iMac or by logging off.
    Does anyone have the same problem ?

    Ok...
    First, it's always good to have a backup browser installed. I use Firefox or Google Chrome.
    For Safari...  try Safari in another user account on your Mac. See if the same thing happens there.

  • Can't click back button in Safari on Iphone

    I'm not sure at which update this began, but I recently realized I can't use the back button in Safari. It just stays dimmed, when normally once you navigate to a new page it illuminates and then you can use it to go back. This is very annoying. Any suggestions?

    Johnster .....
    I am getting the same icon that you are getting whether I use mobile Safari or iCab Mobile identified as Firefox or even if I identity it as mobile Safari. I wonder if that means perhaps the podcasts was not created correctly. However, I know absolutely nothing about creating a podcast.
    You obviously have been doing this successfully up until this point, but by virtue of the fact that I am getting the "No Plugin" icon in both browsers - whether viewing as a desktop browser or a mobile browser, I simply assume that there is a problem with the podcast.
    The podcast plays fine in my desktop Safari on my MacBook.
    Just so that you know, the preinstalled apps are only updated when the iOS is updated. There are never updates released for Safari, iTunes, the App Store and so on, except for the features that may be added when the iOS is updated.

  • How to press a button on a webpage in safari using applescript?

    Hi I am new using the applescript so I am learning about it
    I am right now trying to make one with a webpage
    http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain
    I want to press a button and I can't get to it
    this is what I have until now:
    tell application "Safari"
    activate
              open location "http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain"
              click button "Go"
    end tell
    Please help me with this. At least with the button "GO" then I will figure it out to finish the rest
    thanks

    You might like to experiment with something like this:
    tell application "Safari"
        activate
        set URL of tab 1 of window 1 to "http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain"
        delay 5
        beep 2
        tell application "System Events"
            repeat with CounterA from 1 to 10
                keystroke tab
                delay 0.5
            end repeat
            keystroke return
        end tell
    end tell
    It is a bit rough, but it works on my system (Mac OS X 10.4.11, G5, Safari 4.1.3).
    The intial delay of 5 seconds is to give the page a chance to load - you might need to increase that. The 2 beeps are to give an audible indication of when the rest of the script starts so, if the page hasn't fully loaded, then you know to increase the delay by a few more seconds. (There is a way of somehow checking the page and/or its contents so that the rest of the script will start only once the page has "settled down". I don't know how to do that, but it would make the delay unnecessary and removes the problem of a slow connection taking longer to load the page than normal.)
    The repeat loop sends the tab keystroke 10 times - on my system that's how many presses of the tab key it took to move the "focus" from the URL to the Go button after the "Parking/Red Light..." button. The return keystroke selects that Go button (same as clicking on it), which should then take you to the next page. The 1/2 second delays are there so you can see where things are moving.
    That's as far as I got. Hopefully it will give you a start. You might need to experiment a fair bit to find out if your version of Safari behaves the same way with emulated key-presses using the keystroke command in AppleScript (done from within System Events). When I sent 9 tabs instead of 10 (so that the "Parking/Red Light..." button is highlighted, sending the down arrow keystroke ( keystroke (ASCII character 31) ) made the drop-down menu appear.
    Sorry I can't give more info, but this should get you going. There are probably much better, more reliable and more efficient ways of doing this but sometimes the quick-and-dirty methods fit the bill enough to do the job.

  • Set a default RSS reader when clicking RSS button in Safari?

    When I'm in Safari and I click on the RSS button in a web page, it loads up my podcast app (Downcast) which does me no good.  I use Mr. Reader for my RSS reader (it's a Google Reader client) -- how do I get Safari to load that up instead?  And then presumably it would then create a new subscription feed in Mr. Reader for that RSS feed that I clicked on in Safari.

    I use Reeder. I thought I had this same problem with the last version of Safari but somehow I was able to turn it off (I want to see it first and choose to add it myself to my RSS reader).
    But since Mountain Lion, I haven't been able to turn it off.
    Gary
    http://GarySaid.com/

  • Playing basic sound ( *.wav ) through a click of button ?

    Hi Java experts:
    Need to know the Java code to be added to a click button 1 to play sound ( *.wav ) and the code to stop the sound through and other click of button 2.
    Using a normal applet
    Thank you in advance
    M C Benzerari

    See...the scenario is something like this : I have a main application running into a JFrame instance. Now, from a menu item in this JFrame, I have opened the modal JDialog. And from this modal JDialog, I have created a JFrame. Now I am not able to focus and perform any operation on this JFrame unless I close the JDialog from which it was created.
    Please suggest some workaround so that without closing the JDialog, I am able to fire some event from the JFrame which is being created from this modal JDialog.
    Thanks,
    Gauri

  • When creating a new window in safari, using command T, the marker have not activated the search field. It means you have to click there every time. Changed after upgrading to Mavericks. Anyone knows how to change this?

    When creating a new window in safari, using command T, the marker have not activated the search field. It means you have to click there every time. Changed after upgrading to Mavericks. Anyone knows how to change this?

    Yes, you can do something like that. What you would do is create a button for each image and then hide them. When I do this type of thing I place all of the buttons on a template page and then hide the template.
    You can then use JavaScript to copy the icon from any of the hidden buttons to the main button that you've set up to display the image. For example, suppose you set up 10 buttons named b1, b2, b3, ...b10. The code to copy the icon from one of them to the button used to display the image (b0) would be something like this:
    // Get the icon from the b3 button
    var oIcon = getField("b3").buttonGetIcon();
    // Get  reference to the b0 button
    var f = getField("b0");
    // Set the icon of the b0 button to the icon retrieved from the hidden button
    f.buttonSetIcon(oIcon);
    // Show the b0 button
    f.display = display.visible;
    This code would go in the Mouse Up event of the smaller button.

  • How to control what VoiceOver says when clicking a radio button in Safari?

    Hello-
    I am developing a web page that I want to work in Safari & VoiceOver. Does anyone know how I can:
    1) control what VO says when it is hovering over a radio button (ideally some alt text or title attribute)
    2) control what VO says when I click a radio button in Safari (right now, it seems to say 'Group').
    I have tried to put the radio buttons in a fieldset, tried tons of attributes in the input tag (including alt, title, desc, description), but nothing seems to change.
    Here is a URL where you can hear what I'm talking about: http://postcalc.usps.gov/
    Turn on VoiceOver (try Cmd+F5), pull up the URL and hover over the 'letter' or 'large envelope' radio buttons, then click one of them. It says 'group'. I'd like it to say 'letter option selected' or something.
    Thanks for any & all help!
    Seth
    PS: I do know about the <label> tag. I've tried surrounding my <input> tag with a label and using <label for="someID">, but it doesn't seem to help.

    Thank you for the suggestion...it does work and fires the event, but it is still not selecting the current record when I try to perform an Update or Delete.
    I had to modify your code a bit in order for it work in JDev 10...used the JUCtrlValueBindingRef instead of the FacesCtrlHierNodeBinding.
    Here is what my af:table tag looks like:
    <af:table value="#{bindings.FeesView1.collectionModel}"
    var="row" rows="#{bindings.Fees001View1.rangeSize}"
    first="#{bindings.FeesView1.rangeStart}"
    emptyText="#{bindings.FeesView1.viewable ? \'No rows yet.\' : \'Access Denied.\'}"
    selectionListener="#{backing_viewFees.tableSelectOne1_attributeChangeListener}"
    binding="#{backing_viewFees.table1}" id="table1">
    If I put back my 2 original attributes, then my Delete and Updates work.
    selectionState="#{bindings.FeesView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.FeesView1.collectionModel.makeCurrent}"
    Here is my code in the backing bean:
    public void tableSelectOne1_attributeChangeListener(SelectionEvent selectionEvent) {
    JUCtrlValueBindingRef binding = (JUCtrlValueBindingRef)this.getTable1().getSelectedRowData();
    if (binding != null) {
    Row currentRow = binding.getRow();
    if (currentRow != null) {
    System.out.println(currentRow.getAttribute("CurrentRecordInd")); // this does print my selected value!!!!
    }

  • Simulate Mouse Click using AppleScript

    I want to simulate a mouse click using AppleScript. I used click button of window command but unfortunately it only simulates a half click in the sense that you see the button highlighted but the action is not activated. I used a command key function, where I would press a # many times to make the mouse go down. However, this is very slow. I noticed that there is a couple of additional elements that can be used with AppleScript for example XTools and Extra Suites where I can tell the mouse to go to a certain location and click. I am on a Mac OS X 10.3.9 system (I believe I am using a PowerMac as well) and would like to know if any of the two programs are compatible with this system. I would appreciate any help in how I can install the software and what directory to place the software. Thank you very much for your help.

    Hi, I don't know if the latest version works in 10.3, but might try Quickeys...
    http://startly.com/products/quickeys/mac/4/
    Extra Suites should tell you if it works or not when installing.
    For old Mac SW...
    http://www.oldapps.com/mac/?ModPagespeed=noscript
    I think the most modern Browser for Panther/10.3.9 is Camino...
    http://caminobrowser.org/releases/1.6.9/
    Or iCab 4.8...
    http://www.icab.de/dl.php

  • When trying use any Creative Cloud product on opening an application it attempts to verify my subscription "Membership Expired". I click the button "Try Again" and it says "Thank you, your Creative Cloud is now active. Click Continue to use your product."

    When trying use any Creative Cloud product on opening an application it attempts to verify my subscription "Membership Expired". I click the button "Try Again" and it says "Thank you, your Creative Cloud is now active. Click Continue to use your product." Clicking continue takes me back to the Member Expired prompt. My account and subscription are both active and current.

    Does your Cloud subscription properly show on your account page?
    If you have more than one email, are you sure you are using the correct Adobe ID?
    https://www.adobe.com/account.html for subscriptions on your Adobe page
    If yes
    Some general information for a Cloud subscription
    Cloud programs do not use serial numbers... you log in to your paid Cloud account to download & install & activate... you MAY need to log out of the Cloud and restart your computer and log back in to the Cloud for things to work
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp
    If no
    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Yesterday double clicked home button and all of my apps disappeared; cannot shut off i-pad, and syncing it does not restore apps or enable me to use it again. Help!

    Yesterday double clicked home button and all of my apps disappeared; cannot shut off i-pad, and syncing it does not restore apps or enable me to use it again. Help!

    See if this fixes things.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • HT201371 does touching the home button wakes up the iPhone 5s or do we physically have to Click on Home Button or Sleep/Wake button and then use touch id?

    does touching the home button wakes up the iphone 5S or do we physically have to Click on Home Button or Sleep/Wake button and then use touch id?
    What I am trying to say is that each time I have to click on the home button to wake up the iphone 5s and then it scans my print and logs me in the phone however I was hoping that by just putting the finger on the button will do the whole thing of waking up + unlocking the phone,
    Can anyone please let me know if I am wrong or if I am right? since I just bought iphone 5s and I am not sure if the sensor is working or not the way it should be.

    It sounds like it is working the way it should be. You do have to click one of the two buttons. The closest thing to doing it as a single operation is to click the Home button but don't remove your finger from the button (i.e., leave your finger lightly on the button immediately after clicking it).

  • Am unable to click and open new tabs using the new tab button after downloading the newest version of firefox?

    have recently downloaded the newest version of firefox. after installing i am happy to say i am pleased with the new look and features etc though for some reason i am unable to open new tabs as before.
    i now have to right click on bookmarks or favorites and select open in a new tab to do so, rather than simply clicking on the new tab button..

    If the problem turns out to be the "New Tabs at the End" extension, there actually is an internal setting for this that you could use instead.
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste '''tabs''' and pause while the list is filtered
    (3) Double-click the '''browser.tabs.insertRelatedAfterCurrent''' preference to switch it from true to false. That's it.

  • Im using firefox 4.0.1 and Idm 6.05, I get an error while i click download button.

    Im using firefox 4.0.1 and Idm 6.05, I get an error while i click download button.
    ERROR Displyed is : "cannot connect to dl120.duckload.com:80" and "permission denied. check your Firewall settings and ensure IDM has permits to access internet"
    But i have disabled Windows firewall and i dont have Antivirus.. Plz help me...
    For more plz see tis screen shot : [http://img845.imageshack.us/img845/5234/idmerr1.png link text]

    See if the "stable" version released on 30 June is compatible with Firefox 5.0. That page doesn't mention which versions of Firefox it is compatible with, a serious oversight, IMO. <br />
    https://www.torproject.org/torbutton/
    Plus, it looks like that developer hasn't updated his AMO page in over a year, which makes it impossible for users of that add-on to get automatic updates as each new version of Firefox is released. <br />
    https://addons.mozilla.org/en-US/firefox/addon/torbutton/

Maybe you are looking for

  • How can you make a field "key" in transformation rules - master data maping

    Hello , We are in the process of creating some custom master data datasources for HR module. In this we are trying to extract fields from particular infotypes. In my situation we are pulling fields from only one table PA0032.  From this table I am ma

  • Anyway to search this forum ?

    I am sure this forum contains a lot of usefull information in the 3,400 topics posted, possibly even an answer to my recent post. Is there anyway to do a key word search to find a particular topic ??

  • Can't repair disk permissions on OSX snow leopard

    Hello i have some problem with repairing the disk permissions. I tried repairing them twice but they just keep coming back and i tried to do a clean install but after i updated everything they came back again, anyone have a solution to fix this? Here

  • Mouse freezes periodically upon start up.

    I have a Mac Pro. Every once in a while my mouse freezes in the upper left hand corner of my display upon start up. I am now using a Logitech MX Revolution cordless mouse. Prior to that I was using a Logitech MX500. It was not cordless. The MX500 nev

  • QT supports multichannel, but how do we output it?(Recommend Firewire/USB2)

    I want to output QT multichannel sound from my Intel Mini and G5 to my stereo while playing back H.264 movie trailers and anything I convert from OTA HDTV broadcasts. I know I need up to 7.1 analog output for QT AAC multichannel and digital spdif pas