Jump to content

Automation help.


Recommended Posts

Hello all respected members,

I want help regarding automation script. actually I m trying to create a script that automate the web page of a home wireless router. the script starts and configure the router for dynamic connection type and create a log file for successful and unsuccessful connection. I am getting a problem that every time I run the script it shows same result i.e "successful" even though the internet is not connected at the back (i.e the result statement used after "ELSE" command). I just want to read the status of the router shows as "connected or "Not connected" on home page. please help I am new to programming/scripting and i dont have any big idea, also the coding of the router's GUI is too complex. here is my code:

#include <IE.au3>

#include <Constants.au3>

Func ieNav()

$sUrl = ("http://192.168.2.1/")

$oIE = _IECreate ($sUrl)

_IELoadWait($oIE)

$oHWND = _IEPropertyGet($oIE, "hwnd")

WinSetState ($oHWND, "", @SW_MAXIMIZE )

Sleep(4000)

Send("{ENTER}")

$oFrame = _IEFrameGetObjByName ($oIE, "mainFrame")

_IELinkClickByText($oFrame, "Connection Type")

Sleep(2500)

;Login Page

Send("{ENTER}")

;Connection Type Selection Page

MouseClick ("Left", 700, 450)

Send ("{TAB}")

Sleep (2000)

Send ("{TAB}")

Send ("{ENTER}")

;Dynamic Connection

Sleep (3000)

MouseClick ("Left", 700, 450)

Send ("{TAB}")

Send ("{TAB}")

Sleep (5000)

Send ("Belkin123")

Sleep (2000)

Send ("{TAB}")

Sleep (5000)

Send ("{TAB}")

Sleep (2000)

Send ("{TAB}")

Sleep (2000)

Send ("{ENTER}")

Sleep (5000)

$Frame1 = _IEFrameGetObjByName ($oIE, "topFrame")

_IEGetObjById($Frame1, "7")

If $Frame1 = "7" Then

FileWrite ("Dynamiclogs.log", "Connection Failed" & @CRLF)

Else

FileWrite ("Dynamiclogs.log", "Connection Successful" & @CRLF)

EndIf

EndFunc

ieNav()

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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