Jump to content

Recommended Posts

Posted

Hi,

I'm trying to make a program to connect on my modem over web, since this is my only option to access my modem.

I want to edit my wi-fi network and manage ip-s connected to it.

But i get to a problem where i can't read a id from html when i login to my modem interface.

Problem is appear when i try to read id and click on the item to open menu with sub items to i can get to my wi-fi configuration.

Here is a code and image

#include <IE.au3>

Global $URL = '192.168.1.1'

$ie = _IECreate ($URL, 0, 1, 1, 0) ; url, try attach, visible, wait, take focus
$user = _IEGetObjById($ie, 'Frm_Username')  ; get user field
_IEFormElementSetValue ($user, 'user')      ; set username
$pass = _IEGetObjById($ie, 'Frm_Password')  ; get password field
_IEFormElementSetValue($pass, 'user')       ; set password
$submit = _IEGetObjById($ie, 'LoginId')     ; get id of submit button
_IEAction($submit, 'click')                 ; click to submit / login
Sleep(5000)

; here i got error
;~ --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (mmNet)
;~ --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType

$networkTab = _IEGetObjById($ie, 'mmNet')   ; get id of network div
_IEAction($networkTab, 'click')             ; click on Network tab


; this i try to read
;~ <td class="mid" id="mmNet">Network</td>

 

aa.png

Posted

Several possibilities comes to mind --

1. The page hasn't fully loaded. You could try adding an _IELoadWait after the initial _IEAction (where you current have the Sleep command)

2. Perhaps to page uses frames. Look at the example code in the help file under the entry for _IEFrameGetCollection. You could try running this to check for frames.

Posted (edited)

I added a _IELoadWait and try to run code but same problem. I put _IECreate to make a visible window so i can see what it does.

It successfully open address, login to panel and opens me a panel, but won't click a "Network tab".

Then i used a _IEFrameGetCollection to get data after successfully login and i got this :

  Reveal hidden contents

Code

#include <IE.au3>

Global $URL = '192.168.1.1'

$ie = _IECreate ($URL, 0, 1, 1, 0) ; url, try attach, visible, wait, take focus
$user = _IEGetObjById($ie, 'Frm_Username')  ; get user field
_IEFormElementSetValue ($user, 'user')      ; set username
$pass = _IEGetObjById($ie, 'Frm_Password')  ; get password field
_IEFormElementSetValue($pass, 'user')       ; set password
$submit = _IEGetObjById($ie, 'LoginId')     ; get id of submit button
_IEAction($submit, 'click')                 ; click to submit / login

_IELoadWait($ie, 5000) ; after login to modem panel

Local $oFrames = _IEFrameGetCollection($ie)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($ie, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
ConsoleWrite("Frames Info - " & $sTxt & @CRLF)

And this is an image of a panel

 

bb.png

Edited by stojko22
Posted

So you've identified that there are frames invoived. That's good. Now you need to figure out which frame contains the desired element. Then you would add something like this --

oFrame = _IEFrameGetCollection($ie, 0)          ; assumes the first frame is the desired one
$networkTab = _IEGetObjById($oFrame, 'mmNet')   ; get id of network div
_IEAction($networkTab, 'click')                 ; click on Network tab

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...