This is the third video in a series of automating logging-in to websites using Web Scraping. In this example I automate the login to LinkedIn with AutoHotkey.
Web scraping is an amazingly practical and useful skill-set to have. With more and more programs relying on a web browser for their interface it will only get to be more valuable of a skill to have in your arsenal. Here are links to the Iwb2 learner tool and my web scraping writing tools that I use in the video.
Login to LinkedIn
Here is the script I wrote in AutoHotkey to login to LinkedIn
#SingleInstance, Force Browser_Forward::Reload Browser_Back:: ;************************************************************ pwb := WBGet() if (pwb.locationURL !="https://www.linkedin.com/uas/login"){ pwb.Navigate("https://www.linkedin.com/uas/login") ;Navigate to URL while pwb.busy or pwb.ReadyState != 4 ;Wait for page to load Sleep, 100 } pwb.document.GetElementsByName("session_key")[0].Value :="XXXXXXX" ;Object Name- Set array value ;~ pwb.document.getElementByID("session_key-login").Value :="[email protected]" ;Unique ID-with dashes pwb.document.getElementByID("session_password-login").Value :="The_Stupidist_Password!" ;Unique ID-with dashes pwb.document.getElementByID("btn-primary").click() pwb.document.getElementByID("btn-primary").fireEvent("onclick") ; Sometimes needed in conjunction with click() pwb.document.getElementByID("btn-primary").fireEvent("onchange") ; Sometimes needed in conjunction with click() ;************Pointer to Open IE Window****************** WBGet(WinTitle="ahk_class IEFrame", Svr#=1) { ;// based on ComObjQuery docs static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT") , IID := "{0002DF05-0000-0000-C000-000000000046}" ;// IID_IWebBrowserApp ;// , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ;// IID_IHTMLWindow2 SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle% if (ErrorLevel != "FAIL") { lResult:=ErrorLevel, VarSetCapacity(GUID,16,0) if DllCall("ole32\CLSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 { DllCall("oleacc\ObjectFromLresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc) return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc) } } }