Jump to content

Recommended Posts

Need help logging into the web interface of my WhatsUP gold server for an overhead display in our IT dept.

Essentially I want the script to open IE, navigate to our servers web address, login to whats up, then kill IE and start the process over. ( only because the web interface times out after about 10 mins and logs you out )

Currently I have this:

$user='admin'
$pass='squirrel69'

#include <IE.au3>

Dim $oIE = _IECreate('about:blank', 0, 0)

With $oIE
    .Left = 0
    .Top = 0
    .Menubar = False
    .Resizable = False
    .StatusBar = False
    .TheaterMode = True
    .Toolbar = False
    .Visible = True
EndWith

_IENavigate($oIE, 'http://srv13app8/NmConsole/CoreNm/User/DlgUserLogin/DlgUserLogin.asp')

 

I AM STUCK please help !! :)

 

Link to comment
Share on other sites

Need help logging into the web interface of my WhatsUP gold server for an overhead display in our IT dept.

Essentially I want the script to open IE, navigate to our servers web address, login to whats up, then kill IE and start the process over. ( only because the web interface times out after about 10 mins and logs you out )

Currently I have this:

$user='admin'$pass='squirrel69'
#include <IE.au3>
Dim $oIE = _IECreate('about:blank', 0, 0)
With $oIE.Left = 0.Top = 0.Menubar = False.Resizable = 
False.StatusBar = False.TheaterMode = True.Toolbar = 
False.Visible = TrueEndWith
_IENavigate($oIE, 'http://srv13app8/NmConsole/CoreNm/User/DlgUserLogin/DlgUserLogin.asp')

I AM STUCK please help !! :)

 

Link to comment
Share on other sites

Need a paste in of the user and password inputs (html).

You can also then do a loop waiting for the login screen again, and re-login

edit: not sure if that's a public page, but you might want to remove those creds :)

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

I wouldn not recommend sends...they can be flawed (other apps pick up the sends) or not registered by the app...controlsend is better, but still no way to validate that you are in the proper webpage input.

Download a dom viewer (like IE Developer tools)

They have a pointer tool, you can drag into the inputs (user/password), and will show you the html for that input...paste that back here...or right click the page, and view source...and search for the user/password <input>s.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Sorry

<input name="DlgUserLogin.sPassword" class="Aspf-EditPassword" id="DlgUserLogin.sPassword" accessKey="p" style="width: 190px;" onfocus="this.className+=' Aspf-Control-Focus';" onblur="this.className='Aspf-EditPassword'" type="password" maxLength="100"/>

 

<input name="DlgUserLogin.sUserName" class="Aspf-Edit Aspf-Control-Focus" id="DlgUserLogin.sUserName" accessKey="u" style="width: 190px;" onfocus="this.className+=' Aspf-Control-Focus';" onblur="this.className='Aspf-Edit'" type="text" maxLength="100"/>

Link to comment
Share on other sites

use the _IEgetobjbyid function...pass in the dom object, and "DlgUserLogin.sPassword" to get the password, DlgUserLogin.sUserName for the user...then you can use those returned objects in _IEFormElementSetValue to set the values

do the same to get the login button (by id), and do _ieaction "click" to login

If you can't get it to work, post the new code doing the above steps.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

this is what I did, with no luck. I am new to this sorry

#include <IE.au3>_IEGetObjById(ByRef <input 
name="DlgUserLogin.sPassword" class="Aspf-EditPassword" 
id="DlgUserLogin.sPassword" accessKey="p" style="width: 190px;" 
onfocus="this.className+=' Aspf-Control-Focus';" 
onblur="this.className='Aspf-EditPassword'" type="password" 
maxLength="100"/>  , DlgUserLogin.sPassword)

It did not work

Link to comment
Share on other sites

check the help file for what to add into the function (variables)

example:

$oIE = _IECreate("Yoururl")
_IELoadWait($oIE)
$oLoginPassword = _IEGetObjById($oIE,"DlgUserLogin.sPassword")
_IEFormElementSetValue ($oLoginPassword,"yourpassword")
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

This is what I did

#include <IE.au3>
$oIE = _IECreate("http://srv13app8/NmConsole/CoreNm/User/DlgUserLogin/DlgUserLogin.asp")_IELoadWait($oIE)$oLoginPassword 
= _IEGetObjById($oIE,"DlgUserLogin.sPassword")_IEFormElementSetValue 
($oLoginPassword,"yourpassword")

This is the error in my output window

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut 
"E:\SCRIPTS\monitors\whatsup2.au3"C:\Program Files 
(x86)\AutoIt3\Include\IE.au3 (560) : ==> The requested action with this 
object has failed.:WEndWEnd^ ERROR>Exit code: 1    
Time: 0.531

Please help

Link to comment
Share on other sites

Please do no paste in text, highlight, and then click the code button...it mangles your output...press the code button THEN paste into that window.

Looks like an issue with _IELoadWait...is this consistent?  please paste in the error output again.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

#include <IE.au3>



Call ("signIn")

Func signIn ()
Global $oIE = _IECreate ("http://srv13app8/nmconsole")

Local $username = _IEGetObjByName ($oIE,"DlgUserLogin.sUserName")
Local $password = _IEGetObjByName ($oIE,"DlgUserLogin.sPassword")

_IEFormElementSetValue ($username,"admin")
_IEFormElementSetValue ($password,"squirrel")

EndFunc

Error

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "E:\SCRIPTS\monitors\whatsup.au3"
C:\Program Files (x86)\AutoIt3\Include\IE.au3 (560) : ==> The requested action with this object has failed.:
WEnd
WEnd^ ERROR
>Exit code: 1    Time: 0.732
Link to comment
Share on other sites

Just for fun, try this one...send back the consolewrite data:

Func signIn()
    Global $oIE = _IECreate("http://srv13app8/nmconsole")
    If IsObj($oIE) Then
        ConsoleWrite("Created IE and navigated" & @CRLF)
    Else
        ConsoleWrite("UNable to create IE and navigate" & @CRLF)
        Return False
    EndIf

    If _IELoadWait($oIE) Then
        ConsoleWrite("Page loaded" & @CRLF)
    Else
        ConsoleWrite("UNable to load page" & @CRLF)
        Return False
    EndIf

    Local $username = _IEGetObjByName($oIE, "DlgUserLogin.sUserName")
    If IsObj($username) Then
        ConsoleWrite("Able to find login node" & @CRLF)
    Else
        ConsoleWrite("UNable to find login node" & @CRLF)
        Return False
    EndIf

    Local $password = _IEGetObjByName($oIE, "DlgUserLogin.sPassword")
    If IsObj($password) Then
        ConsoleWrite("Able to find password node" & @CRLF)
    Else
        ConsoleWrite("UNable to find password node" & @CRLF)
        Return False
    EndIf

    If _IEFormElementSetValue($username, "admin") Then
        ConsoleWrite("Able to set login node" & @CRLF)
    Else
        ConsoleWrite("UNable to set login node" & @CRLF)
        Return False
    EndIf

    If _IEFormElementSetValue($password, "squirrel") Then
        ConsoleWrite("Able to set password node" & @CRLF)
        Return True
    Else
        ConsoleWrite("UNable to set password node" & @CRLF)
        Return False
    EndIf

EndFunc   ;==>signIn
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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

×
×
  • Create New...