my overall goal login website , download specific link located on page -- of through vba macro.
however, particular website, cannot view source code of page @ username/password variables, recommended here: http://www.exceltrainingvideos.com/how-to-login-automatically-into-website-using-excel-vba/
i not able view source code because can see, see nothing server until authenticated.
i have functional code open browser. not login.
sub openinfirefoxnewtab(url string) dim pathfirefox string ' pathfirefox = "c:\program files (x86)\mozilla firefox\firefox.exe" if dir(pathfirefox) = "" pathfirefox = "c:\program files\mozilla firefox\firefox.exe" if dir(pathfirefox) = "" msgbox "firefox path not found", vbcritical, "macro ending" exit sub end if shell """" & pathfirefox & """" & " -new-tab " & url, vbhide ' use sendkeys send enter acceptance application.sendkeys "~", true end sub
i using mozilla because our server doesnt have https security certificate (which came on ie), mozilla work around.
how can still login using vba?
edit: opens page, asks want confirm login (prompts pressing ok), never sends ok command. im trying debug , familiarize myself vba debugger.
edit #2: changed sendkeys send "~" no variable. moving down 1 row in excel sheet, instead of pressing enter on mozilla window.
try
processid = shell("""" & pathfirefox & """" & " -new-tab " & url, vbhide) appactivate processid application.sendkeys "~", true
update
modern browsers use multiple processes, bit naive thinking tab process id same starting firefox process id.
appactivate
works part of window title example
shell """" & pathfirefox & """" & " -new-instance " & url application.wait(now + #0:00:05#) ' wait few seconds page load ? appactivate "au" ' example if window title "authentication required" application.sendkeys "~", true
selenium popular browser automation , have selenium ide firefox extension can record actions , convert them code. surprisingly support vba :
http://www.makeuseof.com/tag/how-to-automate-firefox-or-chrome-with-vba-and-selenium/ https://addons.mozilla.org/en-us/firefox/addon/selenium-ide-vbavbs-formatt/
Comments
Post a Comment