Arlen

IE check if already logged

5 posts in this topic

#1 ·  Posted

I'm doing a script to login and check my grades for college and some other useful things. But how can I check if i'm already logged in.

What I have tried is to _IEDocReadHTML and then try to read the string with my username or anything that indicates I am logged. But it never returns the actually real html that I am seeing on my browser. It only returned a logged out html version. Anyway I can find out when I am logged or not. Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi.

Do you attach to an existing browser window or do you create one new? Maybe you have some code for us? In my experience errors often are inside code.

Regards, Conrad


SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE   H:\...\AutoIt3   H:\...\AutoIt3\Include   H: = Network Drive

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

#3 ·  Posted

In the past, I've done this by using _IEFormElementGetObjByName to look for a specific field. If it's there, then I know that I can proceed.

In your case, you could look for the login elements. If they are present, then proceed to login. Otherwise, assume that you are already logged in and skip that step.

Share this post


Link to post
Share on other sites

#4 ·  Posted

3 hours ago, Simpel said:

Hi.

Do you attach to an existing browser window or do you create one new? Maybe you have some code for us? In my experience errors often are inside code.

Regards, Conrad

I use _IECreate for this. 

Local $Username = GUICtrlRead($User)
    ;MsgBox(0,"", $Username)
    Local $Password = GUICtrlRead($Pass)
    ;MsgBox(0,"", $Password)
    Local $Nickname = GUICtrlRead($Nickname_)
    ;MsgBox(0,"", $Nickname)

Local $oIE = _IECreate("https://procesos.intec.edu.do", 0, 1, 1, 1)

Local $DocRead = _IEDocReadHTML($oIE)
FileWrite("Document.html", $DocRead)

If StringInStr($DocRead, $Nickname) Then
    GUICtrlSetData($Status, "Successful !")
Else
    GUICtrlSetData($Status, "Failed")
EndIf

 

Share this post


Link to post
Share on other sites

#5 ·  Posted

2 hours ago, Danp2 said:

In the past, I've done this by using _IEFormElementGetObjByName to look for a specific field. If it's there, then I know that I can proceed.

In your case, you could look for the login elements. If they are present, then proceed to login. Otherwise, assume that you are already logged in and skip that step.

I tried   "_IEFormElementGetObjByName" but it still found it even logged.

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

  • Similar Content

    • kawliga751
      By kawliga751
      I have a workplace GUI that has a search field function that pulls up customer records to allow changes. I am attempting to 1)LOGIN 2)Enter Search field, enter a number and then {ENTER} 3)change specific field once customer record loads. I have very limited experience in GUI manipulation but I am able to login using the below:
      #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/ASAG/index.htm') Call ("RacksheetSignIn") Func RacksheetSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/RackSheets/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc However I can't seem to use the _IEGetObjByName or Mouseclick to focus on the search field to allow me to enter my search criteria. When I "inspect element" in the Search field I get the attached:
       
      Any help would be MUCH appreciated
       
       
       

    • TotalAuto
      By TotalAuto
      Hi All
      I am new to AutoIT, its community, and pretty much programming in general. 
      After a bit of online research, I decided to focus on AutoIT as my first programming attempt as it seems quite powerful and amazing once you become advanced at it. I have read some introductory pdfs which where good, including from the guy I think who invented it. I also watched various sketchy youtube videos, checked out the forum etc. I have to admit it's a bit confusing starting off but I reckon if I just keep pushing forward with continual hard work I can only get better.  
      My first AutoIT project has been to open Internet Explorer and automatically log into Twitter to save doing it manually. I plan to run this after windows start up via task scheduler. I am using the #include <IE.au3> UDF but for some reason about 20% of the time I receive the following orange error notifications at the bottom of the editor (pic attached). When it happens the IE browser just doesn't open but the program continues to run which mucks up the script. 
      Does anyone know why this is happening and how it can be fixed? Also is there some other better, less error prone way, to open IE and automatically log in?
      I have tried to use the Get Object NAME and ID commands to insert the username and password (i.e. the xxxxxxxxxx's) but when I right click to use "Inspect element" there is no name or id. It seems to be some sort of java script reference?
      I am using Windows 7 with latest updates and Internet Explorer version 11.
      As this is my first post I hope I am following protocols, and if not, please let me know and I will improve.
      Thanks

    • ur
      By ur
      For the below form, I am able to automate using below code for textboxes.

      #include <IE.au3> Local $oIE = _IEAttach("http://localhost:18170/MartAdmin/", "url") _IELoadWait($oIE) $Search = _IEGetObjById($oIE,"x-auto-16-input") _IEPropertySet($Search, 'innerText','Uday KIran') $Search = _IEGetObjById($oIE,"x-auto-18-input") _IEPropertySet($Search, 'innerText','Uday KIran') But for the Login button, there is no id or name.
      The html code when I click on Inspect element in browser, shown below.
      <button tabindex="0" class="x-btn-text" style="width: 64px; position: relative;" type="button">Log In</button> Please let me know how to click this.?
       
    • Hanukka
      By Hanukka
      Hi guys, 
      I was trying to automate a webpage after getting input from excel. The script worked fine for like 5 iterations but then stopped all of a sudden, I dont have the exact error msg now, but it was pointing to this in the IE UDF:-
      Return SetError($_IESTATUS_Success, $oTemp.GetElementsByTagName($sTagName).length,
      When i looked up the forum there was a similar question which said that I have to fix KB 3008923 update by uninstalling it, but I am unable to do that. 
      here is the link for download:- ( i guess )
      https://support.microsoft.com/en-us/help/3024777/error-0x800706f7-occurs-after-you-install-kb-3004394-and-then-run-windows-update-in-windows-7-and-windows-server-2008-r2
      Does anybody know the proper steps to solve this??
      Plus I wont be able to send the code here because of privacy policy n all by the company.
      Desperately looking for a reply.....
    • Hanukka
      By Hanukka
      Hello there,
      https://stackoverflow.com/questions/901712/how-to-check-whether-a-checkbox-is-checked-in-jquery
      I want to check the checkbox in the frame which pops up after choosing "run code snippet" option. ( Internet Explorer one would be prefered )
      Can you please please send the right code or some snippet here..