Help clicking java script button Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
matt man

Help clicking java script button

15 Apr 2018, 08:51

Hi All,

I am a relative noob (so no flaming please) and have been trying to automate a modem configuration using AHK. I have also poured over these forums and can't seem to solve my initial little issue, and have also watched videos on using 'iWB2 Learner' to find attributes.

First a little bit of background: Why am I trying to do this? Because at work we have been tasked with configuring 4,000 Netgear DM200 modems for a national roll out. Unfortunately, these modems don't allow ssh or tftp, so we are stuck using the modem user interface to manually click through options and load the config file.

During this time I have had several issues trying to automate this due to the following:

1. Initially recorded macros as a script but had issues upon reuse due to maximized IE vs minimized (items weren't in the same place always)
2. Differing hardware / screen resolution (Laptops supplied by the project are different models, with different screen resolutions - clicks aren't at the same screen location)
3. Differing web application start (sometimes the first action is a login dialogue, other times it does not challenge for authentication and lands on the first web page)

My main stumbling block at the moment is that there is a 'Next' button in a frame at the bottom of the first page. It is a button without a label or on_click() attribute within the HTML and the button doesn't get focus using the TAB key.

I used 'iWB2 Learner' and have found it has the following attributes (Can't seem to upload a pic so I'll write it out):

iWB2 Learner :: <DIV> [9]
Title: NETGEAR Router DM200 (funny since it's a modem)
Url: http://192.168.5.1/BRS_index.htm
Index: 160
Name:
ID: btn_div
Frame #: IFRAME.1
Index: 16
name: content_frame
id: content_frame
Inner Text: document.write(bh_next_mark)Next
OuterHTML: <div class="buttons_words_div"
id="btn_div"><script>document.write(bh_next_mark)

Over the last few days I have tried many variations of this, but the code I am currently trying to use is:

wb.document.GetElementsByTagName("DIV")[9].Click() - (which doesn't seem to work).

Any help would be truly awesome and thank you in advance.

Cheers,

Matt
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Re: Help clicking java script button

21 Apr 2018, 18:57

if its in a frame maybe try this.

WB.document.parentWindow.frames["content_frame"].document.getElementById("btn_div").click()
mattman
Posts: 2
Joined: 15 Apr 2018, 06:34

Re: Help clicking java script button  Topic is solved

21 Apr 2018, 21:52

Thank you so much grimboto. :bravo: This worked like a charm. :dance:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Frogrammer and 264 guests