Sign in to follow this  
Followers 0
kalel69

unable to log into my company's Internet Explorer based application.

3 posts in this topic

Hi Folks.  Looking for a little assistance to help login to one of my company's application's web pages.  These are Intranet based pages, and not open to the general public, and I will try to provide the code and screen shots where I can.  I have been attempting to get this login script to work for quite some time.  Any help would be appreciated. 

I have 3 types of issues here.

1.  using the basic _IEFormElementSetValue, instead of replacing the grayed out verbiage (user name) with an un-grayed out text (actual user name in black type font), it does enter the user name, but it is entered still as grayed out text in the input box.

2.  to get the above to work, i've replaced using _IEFormElementSetValue and instead use an "_IEAction" (2 actually - focus / select all) then a "send" to manually put in the username.  This works upon initial launch of the page, but when logged out, and logging back in, the IEactiion and send fail to enter the fields.

3.  My company has an .hta application that launches a reporting app, but the page is designed exactly the same as the web page, (except the app contains the code - the .hta app), but it is still the exact same fields defined.  Theoretically knowing the input boxes names as I do and that they're the same, I should be able to log into this app the same way.  However, I can not.  I once contacted dale through email to question why the .hta app would not respond, and he gave me some ideas, and stated if I still have issues, to post a topic here.  so this is what I'm doing, because I still have issues with the .hta app.  And I've also tried to attach to the .hta application as an embedded application, but still could not get the fields to populate (log in screen).

I have attached screen shots of the intial view of the sign on page, and the view of an attempted signon using _IEFormElementSetValue.

Here is my code to attempt to attach / launch-create the web page.

Func _LaunchAdminApp  ()
    If      $CurServNam= "" Then Return
    If      WinExists("PCDS :: Management") Then Return
    Local   $FTMAddress= "https://"&$CurServNam&"/admin"
    If      NOT WinExists("Fluency for Imaging Log On") Then
            Local $oIE = _IECreate($FTMAddress)
        Else
            Local $oIEWhnd = WinGetHandle("Fluency for Imaging Log On")
            Local $oIE = _IEAttach($oIEWhnd)
    EndIf
    Local   $Count     = 0
    If $AdmAutoLogin   = 1 Then
        If $LoginIDAA = "" Then Return
        Do
            $Count+=1
            Sleep(100)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")
                Return
            EndIf
        Until IsObj($oIE)
        Local   $oForm     = _IEFormGetCollection($oIE,0)
                $Count     = 0
        Do
            $Count+=1
            Sleep(100)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")5
                Return
            EndIf
        Until IsObj($oForm)
        WinActivate($oIE)
        Local   $oQueryUser= _IEFormElementGetObjByName ($oForm,     "UserName"       )
        Local   $oQueryPW  = _IEFormElementGetObjByName ($oForm,     "PasswordDisplay")
        Local   $CompID    = _IEFormElementGetObjByName ($oForm,     "Domain"         )
        Local   $oSubmit   = _IEFormElementGetObjByName ($oForm,     "loginBtn"       )
        Sleep(500)
                            ;_IEAction                  ($oQueryUser,"focus"          )
                            ;_IEAction                  ($oQueryUser,"selectall"      )
                            ; Send                      ($LoginIDAA                   );this will work only for initial login, not for subsequent log in's after logoff.
                             _IEFormElementSetValue     ($oQueryUser, $LoginIDAA      );this does not work.  enters name in gray text, app does not think its there, but can see it.
                            ;_IEAction                  ($oQueryPW,  "focus"          )
                            ;_IEAction                  ($oQueryPW,  "selectall"      )
                            ; Send                      ($PasswordAA                  );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryPW,  $PasswordAA      );this does not work.  enters password in gray text, app does not think its there, but can see it.
                            _IEFormElementOptionSelect  ($CompID,0,1,"byIndex"        )
        Sleep(5000)
        If IsObj($oSubmit) Then $oSubmit.click()
    EndIf
    If $CloseAfSelAA   = 1 Then Exit
EndFunc

Basically, i'm checking to see if the pages exists first, then either creating a page or attaching to a page depending upon the results of the check.

I've also attached the source for the signon page for the web app.  Note that the code delivered via the .hta for sign on is exactly the same.

any and all suggestions are most welcome.  I'm at my witts end here! 

Thanks in advance!  (I love AutoIT! and this site!)

view of signon screens.zip

Company Application Signon Page.html

Share this post


Link to post
Share on other sites



I dont know if it will help but firstly your do loop for sleep has a max time out of 3 seconds.

When I automate a page I focus on the form and when I submit all values are recognized. I think I had a problem too until I put in the IEAction Focus (which I see is commented out in yours)

_IENavigate($oIE, "Somepage.com")
    _IEAction($oIE, "stop")
    Local $oForm = _IEFormGetObjByName($oIE, "searchform")
    _IEAction($oForm, "focus")
    If @error Then ConsoleWrite ( @CRLF & "Error Parameter: " & @extended & " / Error: " & @error & @CRLF)
    _IEFormElementRadioSelect($oForm, 0, "dec", 1, "byIndex")
    $oText = _IEFormElementGetObjByName($oForm, "latt")
    _IEFormElementSetValue($oText, $strLat )
    $oText = _IEFormElementGetObjByName($oForm, "longt")
    _IEFormElementSetValue($oText, $strLon )
    _IEFormSubmit($oForm)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I do appreciate the reply.  just so you know, it is commented because I have tried both methods.  when I use IEFormElementSetValue, it grays the text.  when I REM out IEFormElementSetValue, and only use send (with focus), it works, but only for the iecreate.  not with ieattach.  I can't get ieattach to work either way.  I may try, as you mentioned, a combination of both when I get home.  I will post back later.   thanks again for the response!

<got home>

Tried the fix from Shane0000 (thanks). and it fixed item number 1, although I also added an additional line of text, because I now noticed for some reason, there are 2 input's for the password ("PasswordDisplay" and "Password").  So I went ahead and sent the password to both using the fix from Shane0000, and it works for item number 1 now, without having to use the "send" command.  I'm excited about that! 

Func _LaunchAdminApp  ()
    If      $CurServNam= "" Then Return
    If      WinExists("PCDS :: Management") Then Return
    Local   $FTMAddress= "https://"&$CurServNam&"/admin"
    If      NOT WinExists("Fluency for Imaging Log On") Then
            Local $oIE = _IECreate($FTMAddress)
        Else
            Local $oIEWhnd = WinGetHandle("Fluency for Imaging Log On")
            Local $oIE = _IEAttach($oIEWhnd)
    EndIf
    Local   $Count     = 0
    If $AdmAutoLogin   = 1 Then
        If $LoginIDAA = "" Then Return
        Do
            $Count+=1
            Sleep(200)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")
                Return
            EndIf
        Until IsObj($oIE)
        Local   $oForm     = _IEFormGetCollection($oIE,0)
                $Count     = 0
        Do
            $Count+=1
            Sleep(200)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")5
                Return
            EndIf
        Until IsObj($oForm)
        WinActivate($oIE)
        Local   $oQueryUser= _IEFormElementGetObjByName ($oForm,     "UserName"        )
        Local   $oQueryPW1 = _IEFormElementGetObjByName ($oForm,     "PasswordDisplay" );where did this come?  -  <input  id="PasswordDisplay"
        Local   $oQueryPW2 = _IEFormElementGetObjByName ($oForm,     "Password"        );                      -  <input  id="Password"
        Local   $CompID    = _IEFormElementGetObjByName ($oForm,     "Domain"          )
        Local   $oSubmit   = _IEFormElementGetObjByName ($oForm,     "loginBtn"        )
        Sleep(500)
                            _IEAction                   ($oQueryUser,"focus"           )
                            _IEAction                   ($oQueryUser,"selectall"       )
                             Sleep(500)
                            ;Send                       ($LoginIDAA                    );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryUser, $LoginIDAA       );this does not work.  enters name in gray text, app does not think its there, but can see it.
                            _IEAction                   ($oQueryPW1,  "focus"          )
                            _IEAction                   ($oQueryPW1,  "selectall"      )
                             Sleep(500)
                            ;Send                       ($PasswordAA                   );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryPW1,  $PasswordAA      );this does not work.  enters password in gray text, app does not think its there, but can see it.
                            _IEAction                   ($oQueryPW2,  "focus"          )
                            _IEAction                   ($oQueryPW2,  "selectall"      )
                             Sleep(500)
                            _IEFormElementSetValue      ($oQueryPW2,  $PasswordAA      )


                            _IEAction                   ($CompID,    "focus"           )
                             Sleep(500)
                            _IEFormElementOptionSelect  ($CompID,0,1,"byIndex"         )
        Sleep(500)
        If IsObj($oSubmit) Then $oSubmit.click()
    EndIf
    If $CloseAfSelAA   = 1 Then Exit
EndFunc

Thanks.  1 down.  2 to go!

Still won't re-login after logging out.  (item 2 above).  and still nothing from the .hta app (that uses the same code as the web page).

Any further assistance would be greatly appreciated.  Please don't forget I've attached screenshots in a zip, and the .html code page for the login page.

Thanks again!

Edited by kalel69

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  
Followers 0

  • Similar Content

    • Omnitica
      By Omnitica
      Hello!
      I'm new to the forums! Couldn't find any threads covering this issue. Sorry if I'm wrong.

      I'm having problems changing the text/value of a input box. The particular box doesn't have a name or id, just: class="jq_hotkeys_enabled form-control".
      This class appears multiple times throughout the source, so I don't think It's right to reference that object. 
      See image 1.
      However, I've managed to find a object with the name "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper" which contains the value of the input box, and the id for the person in the dropdown/combobox left of it. (with "dummy-1" selected).
      See image 2.
      As you can see the value is 3982,4545     ( name , time )
      But when I try to change the value of it by doing:
      #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") The box doesn't get its new value. I  can see in the source that it's changed though.
      See image 3.
       
      However, if I do: 
      #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") $oIE.document.parentwindow.execScript("theForm.submit()") ; But it needs to reload the page The box gets its new value after the page reloads by the theForm.submit() function. 
      This is a bit unfortunate as I want the changes to happen instantly like when I type in the box with the keyboard... or select in the combobox.
      Maybe someone knows how I can do this? Looking forward to an answer! 
      Thanks in advance.
       
      Note: Unfortunately I can't provide with the real URL as it is constricted to employees in the company I work for, but let me know If I should provide anything else.
       



    • steveeye
      By steveeye
      hey, can anybody enlighten on lesser known Windows hacks or uses ?
    • afallenhope
      By afallenhope
      Hello all! 
      I am having a bit of trouble and was wondering if anyone may have a workaround for my issue. I made a script that would automatically install a piece of software each night on a Windows 7 Box. Now I have been instructed to do the same with a Windows 10 box since the application is now being tested on Windows 10. 
      The way I did the win7 installation was that I made a script and then made an executable that I call with a batch file along with the Installer. So the process is 
      AutoitMainFile calls batch file, batch file opens Installer, and the automatedinstaller.exe  The automatedinstlaller waits 10-20 seconds to make sure the Installer has been fully loaded.
      When I try to do the same both get loaded but the automatedinstallation.exe does not send commands to the installer. The code does work and nothing from the program we are wanting to install has changed as our Windows 7 runs every night no problem. 
       
      Do I need to make a new automatedinstall script for windows 10? 
      Any advice is appreciated 
      Thanks,
      Richard
    • ur
      By ur
      I have enabled admin sharing in the remote machine so that I can copy files to the remote machine use PSEXEC to execute our application remotely.
        Now, if the machine is poweredoff we need to poweriton. So I checked whether the remote machine, it is of both VirtualBox or VMWare one. For VirtualBox or VMware, I have found command line utities to poweron.   But to autologon by skipping the login screen.Can anyone suggest how to do the same.If it is a physical machine, then there is no need to poweron but autologon is required.   I am trying for windows machines.Win 7 at present.   For VirtualBox I checked below link with help og guestadditions but not working. http://www.virtualbox.org/manual/ch09.html#autologon   The below procedure will save the password in that machine and it will logon automatically.   http://www.howtogeek.com/112919/how-to-make-your-windows-8-computer-logon-automatically/   But it will give access to everyne.But my opinion is he should access only if have credentias.I mean through any commandline from another machine he should trigger logon also by passing credentials.     Similarly this also   http://www.cnet.com/how-to/automatically-log-in-to-your-windows-10-pc/   http://superuser.com/questions/28647/how-do-i-enable-automatic-logon-in-windows-7-when-im-on-a-domain   http://pcsupport.about.com/od/windows7/ht/auto-logon-windows-7.htm   http://www.computerperformance.co.uk/windows7/windows7_auto_logon.htm   https://technet.microsoft.com/en-us/magazine/ee872306.aspx   Please guide me how to proceed.
    • AJB
      By AJB
      Hello,
      I've been using autoit for about a year now and overall it's been great despite my limited understanding of all of its features. I have several scripts that run on virtual machines that have been running smoothly for several months without any issues. Recently, I had to create new virtual machines and migrate my scripts over and now I am getting errors that I can't seem to repeat, but seem to happen at least once a day with all of my executables that were flawless before.
      The error that I keep getting is:
      Autoit Error
      Line [this number varies per script] (File "[path to my executable]"); Error: variable must be of type object.
      I  never received this error before until I moved everything to the new VMs, and when I rerun my scripts after clearing the error everything seems to work and run fine until hours later or sometimes the next day. I am assuming that that the root cause may be in some kind of settings on the VM itself since it is happening nearly across the board, but I have no idea where to even look. These are running on Windows 7, which is what they were running on before I had any errors.
      The only consistent include used in these scripts is  IE.au3
      Has anyone run into a similar problem or can maybe point me in the right direction. I am at the point of pulling hair out trying to resolve this. I have even rewritten and re-compiled the scripts to see if somehow the executables got corrupted, but that didn't help.
      Thank you.