Here is what I want to do
1. Create ComObj
2. Navigate to a URL (HTTPS)
3. Login into webpage
4. Click on links in the new techportal page
It appears that between creating the com obj and navigating to a URL the pointer to the Web Browser object changes.
I know this because I can hide and unhide the com obj but as soon as I navigate to my techportal address I no longer can control this website with the old pointer. I have to find the new one. Which I suppose is okay, but I have multiple scripts to navigate this website that do alot of different things including navigating several pages deep.
I would like to be able to hide all the pages until the last page then make it visible with WB.Visible := true
The code can be run as is.
WB := ComObjCreate("InternetExplorer.Application") WB.Visible := true MsgBox the com obj is visible. The pointer is good. WB.Visible := false MsgBox the com obj is invisible. The pointer is good WB.Navigate("https://techportal.wwts.com/qxsweb/default.cfm") While WB.Busy ;[color=red]I suspect the pointer here is invalid which means I have no way of knowing when the page is fully loaded[/color] Sleep, 100 MsgBox why is it visible again?`nIs it because the pointer is no longer valid?`n`nThis pretty much explains it all, I hope. With an invalid pointer I can do nothing with the webpage /* ;The code below this comment section never works until I get the new pointer. ;I get the new pointer this way, which works perfectly, I can log in just fine. For WB in ComObjCreate("Shell.Application").Windows If InStr(WB.LocationName, "WWTS Extranet | Technician Portal") break ;With the new pointer I can hide/unhide, click on links and anything else I want */ MsgBox exitapp I added this so you can test the code exitapp iniread,PortalUsername,config.ini,credentials,PortalUsername iniread,PortalPassword,config.ini,credentials,PortalPassword WB.document.all.Login.value := PortalUsername WB.document.all.Password.value := PortalPassword WB.Document.all.80.click() While WB.Busy Sleep, 100 WB.Navigate("https://techportal.wwts.com/qxsweb/emp/oneview_record.cfm") While WB.Busy Sleep, 100 WB.Visible := true MsgBox done
When I turn Protected Mode off then I can use the same pointer created by comobjcreate to navigate this webpage.
It appears when I navigate to an HTTPS the original window is closed and a new one is created with a new pointer.
As my code demonstrates I can get the new pointer, but I want to be able to navigate several pages deep before I make the window visible for the first time.
EDIT: 12:56PM 1/10/2012
I found that if I run the script as administrator it keeps the same pointer that was created by comobjcreate. That may be my only solution.
thanks
DataLife
[Moved from General Chat]