InternetExplorer.Application using Framesets and Frames

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
snakecharmer
Posts: 2
Joined: Thu Jan 17, 2013 5:58 am

InternetExplorer.Application using Framesets and Frames

Post by snakecharmer » Thu Jan 17, 2013 5:58 am

Good afternoon gentlemen,

I need to make a script that enters an URL, fills in some sign in fields, and then collects some information from there.

I've managed to make a functional script using GMail as an example, and it goes like this:


************************************************************************************************************

Set IE = CreateObject("InternetExplorer.Application")

sURL = "http://www.gmail.com"

With IE
.Navigate sURL
.Visible = True
End With


' loop while it waits for InternetExplorer to load

Do While IE.Busy
Loop


' inputboxes value are assigned to "fname" (login) and "fpwd" (password) variables

fname=InputBox("Enter your name","Userinput")

fpwd=InputBox("Enter your password", "Userinput")


Set UserN = IE.Document.getElementById("Email")
If Not UserN Is Nothing Then
' assigns the fname value to the element "Email"
UserN.Value = fname
End If

Set PW = IE.Document.getElementById("Passwd")
' password
If Not PW Is Nothing Then
' assigns the fpwd value to the element "Passwd"
PW.Value = fpwd
End If


' finds the login button and clicks on it
Set btnInput = IE.Document.getElementById("signIn")
btnInput.Click

***************************************************************************************************************

The above mentioned code works perfectly. However, I need it to work at my job's intranet.

The problem is: the intranet url with the Login and EMail is inside a specific frame, which is inside a frameset (I am completely ignorant when the subject is html and stuff like that).

When I try to use my script, I get the "Unkow Interface" error.

Does anybody know how can I handle the frames properly??

Thanks,

Ricardo Fazzio

User avatar
jvierra
Posts: 13479
Joined: Tue May 22, 2007 9:57 am
Contact:

InternetExplorer.Application using Framesets and Frames

Post by jvierra » Thu Jan 17, 2013 6:38 am

Frames are usually inaccessible. gmail should not be in a frame. Perhaps your browser does not have javascript enabled.

User avatar
snakecharmer
Posts: 2
Joined: Thu Jan 17, 2013 5:58 am

InternetExplorer.Application using Framesets and Frames

Post by snakecharmer » Fri Jan 18, 2013 3:12 am

jvierra,

The GMail example I've posted works fine. However, this code doesn't work when I try to use it in my job's intranet. The login/password is in a frame called "reg04/consulta_ferias/CFloginficha.shtml". I tried to set the URL variable to this adress, but I keep getting error messages and can't fill the login/password fields properly.

User avatar
jvierra
Posts: 13479
Joined: Tue May 22, 2007 9:57 am
Contact:

InternetExplorer.Application using Framesets and Frames

Post by jvierra » Sun Jan 20, 2013 5:24 am

The reason you are getting the frameset is becauselikely due to the version of IE being used or to compatibility settings being enforced by Group Policy or because of firwall settings that do not allow advanced features of the broser to be used.

You will need to recode to discover the frame and to address the contents appropriate. There is no magic switch to accomplish. It is a completely different page.

I have inspected the Google page under all settings an find no indications of frames being used in IE7 and later.

Locked