Hello,
I would like to find the button on a web page that says for example 'Enter" and when found on the page click on it ?
do you know way to do it ?
Thanks for your help
Br,
Stéphane
Hello,
I would like to find the button on a web page that says for example 'Enter" and when found on the page click on it ?
do you know way to do it ?
Thanks for your help
Br,
Stéphane
I use 2 methods to do this in Firefox.
1: Press tab to navigate webpage elements.
Handy if the button is within 10 Tabs, otherwise it feels silly.
2: Activate the button/focus it via javascript.
Reliable, just need to get the element ids. Just make sure javascript is enabled in your browser!
Method 1 is easy enough to sort out on it's own. Here's an example of Method 2 and how to use it:
This example uses http://www.autohotkey.com/board/
At the bottom of the page we have displayed users currently online. Let's say we need to open the profile of whatever the first name is of that list.
Step 1, Right click the first name under where it says "# members, # guests, # anonymous users (See full list)".
In my case it's my username so I'll assume it will be your own if you're signed in. Click Inspect element.
Step 2, Look for something that says, id="copy_this_text" For this example it was anonymous_element_15
You'll be able to tell here if the item in question is a button.
Step 3, Paste the id without quotes into this: javascript:document.getElementById("paste_text_here").focus()
You can test it out by just pasting the underlined text into your browsers url.
Below is a fully functional example.
The function TabCheck isn't used, but it can come in handy for error checking. TabCheck ensures you went to the right place, or checks to see if you haven't gone to the next webpage yet. It does not ensure that the webpage you're on is fully loaded.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 /* Firefox navigation example Start here: http://www.autohotkey.com/board/ */ Java(paste) ;executes javascript in url bar { Clipboard = Clipboard := paste ClipWait, 1 Sleep 10 Send {F6} ;default key to focus the url in firefox Sleep 50 Send javascript: Sleep 50 Send ^v Sleep 50 Send {Enter} Sleep 120 } TabCheck(name) ;check for being on the right webpage, useful if you know where you're supposed to be { ;mouse-over the tab title to get it's name WinGetActiveTitle, starttitlevar Sleep 1000 ifWinActive, %name% { ;next webpage is open Sleep 500 ;msgbox, %name% is active window`n%starttitlevar% was start title ;`n ignore this ;msgbox, Press enter when the page has loaded. ;sometimes needed for heavy/sporadic loading times } else { ;next webpage not open yet Sleep 1000 ;adjust this to your needs TabCheck(%name%) } } ; example id ;anonymous_element_15 ; use for buttons ;__doPostBack('','') ; use for links/input fields ;document.getElementById("").focus() pressit = __doPostBack('anonymous_element_15','') focusit = document.getElementById("anonymous_element_15").focus() ;insert key Ins:: Java(focusit) Send {Enter} return
For Chrome use Tampermonkey extensions
For Firefox they say there is Greasemonkey add-on
write a script.
use settimeout, setinterval, clearinterval commands ( javascript ) in addition with .click() etc.
I have made something exactly for this purpose. In case you are still around please tell details. that is The Inspect Element etc.