Jump to content
Sign in to follow this  
nick448

Script Help

Recommended Posts

nick448

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 !! :)

 

Share this post


Link to post
Share on other sites
nick448

Thanks!

Share this post


Link to post
Share on other sites
nick448

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 !! :)

 

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
nick448

I am not sure how to do that

I was thinking I could do a

send($user)
send("{TAB}")
send($pass)
send ("{ENTER}")

But there has to be a better way

Share this post


Link to post
Share on other sites
nick448

It is not a public site and I changed the creds to fakes :) thankss

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
nick448

DlgUserLogin.sUserName

DlgUserLogin.sPassword

 

:thumbsup:

Share this post


Link to post
Share on other sites
jdelaney

paste in the whole tag <input blahblahblahblah>blahblab</input> for both


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.

Share this post


Link to post
Share on other sites
nick448

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"/>

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
nick448

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

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
nick448

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

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
nick448

#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

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • TLAM
      By TLAM
      Hello,
      I am working on an autoIT script for CyberArk which is running Internet Explorer and connecting the user to a web application.
      For an unknown reason (I cannot explain why), IE has some trouble to start, only after a long disconnecting period (morning or after lunch). If he tries again, no problem, IE starts.
      I open a case with CyberArk but I am also searching a workaround, I thought to kill the process directly, or set a timeout with _IELoadWait but the process is not really created..

      May do you have any ideas for helping me ?

      Thanks in advance
       
    • Seminko
      By Seminko
      Wrote a script that grabs all of the IP addresses from Netflix's IP log, checks the IPs and returns suspicious activity.
      Everything works as it should but only when _IECreate is set to visible. When visible is set to false, it fails to login for some reason.
      Any ideas what might cause it and/or how to circumvent that?
    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • hemichallenger
      By hemichallenger
      Hello,
      If anyone can help, it would be greatly appreciated. The code is just an example and similar to the issue with an internal webpage. I'm trying to autofill than click the submit button. I get the same error running the script.
      _IEFormElementSetValue, $_IESTATUS_InvalidObjectType
      IEGetObjById, $_IESTATUS_NoMatch
      Is it possible to edit the <textarea></textarea>  field with AutoIt?  If anyone could assist me on how. Than I could have a better understanding and chance in figuring it out on my main script. Thank you
      #include <IE.au3> Local $oIE1 = _IECreate ("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea") _IELoadWait($oIE1) local $oFormCollection = _IEFormGetCollection($oIE1,0) local $oid = _IEGetObjByid($oFormCollection, "iframeResult") _IEFormElementSetValue($oid, "test") sleep (2000) Local $oIE2 = _IECreate ("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_scripts_intro") _IELoadWait($oIE2) $oForm2 = _IEFormGetCollection($oIE2,0) $oClickMe = _IEGetObjById($oForm2, "demo") _IEAction($oClickMe, "focus") _IEAction($oClickMe, "click")
×