Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

click button on web page

Featured Replies

I have a problem getting Applescript to click a button on a web page. And although it is the only button on the page I cannot use the usual option of "keystroke return" as it simply doesn't work. My script goes like this and it is the line «click button "login"» that provokes the error. The problem does not stem from the password or User ID not being correct or entered as Safari does this automatically. Any ideas on remedying this?

tell application "Safari"

activate

make new document

set URL of document 1 to "https://www.orange.ch/footer/login"

end tell

if page_loaded(5) then

tell application "System Events"

tell application process "Safari"

click button "login"

end tell

end tell

else

display alert "The URL Has Not Loaded."

end if

on page_loaded(timeout_value)

delay 2

repeat with i from 1 to the timeout_value

tell application "Safari"

if (do JavaScript "document.readyState" in document 1) is "complete" then

return true

else if i is the timeout_value then

return false

end if

delay 1

end tell

end repeat

end page_loaded

  • Author

I finally found a solution to all this. It isn't very elegant but at least it works. I realised this if you hit the tab key 16 times once the page had opened, the login button finally becomes operational. You only need then hit the return to login. So here's my script

tell application "Safari"

activate

make new document

set URL of document 1 to "https://www.orange.ch/footer/login"

end tell

if page_loaded(5) then

tell application "System Events"

tell application process "Safari"

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke tab

keystroke return

end tell

end tell

else

display alert "The URL Has Not Loaded."

end if

on page_loaded(timeout_value)

delay 2

tell application "Safari"

repeat with i from 1 to the timeout_value

if (do JavaScript "document.readyState" in document 1) is "complete" then return true

delay 1

end repeat

end tell

return false

end page_loaded

Doesn't it make more sence to go directly to the page where the login button directs you to?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.