J_K_M_A_N
asked on
Web pages that use input from user. Part 2.
I had asked a question here:
https://www.experts-exchange.com/questions/21378895/Web-pages-that-use-input-from-user.html
That solution worked for many web pages but I am having a problem with a few. Like the one below. It will open the page but it won't fill in any info. Am I doing something wrong? Is there some other code I should be using instead? Thanks for any help.
Dim IEo As InternetExplorer
Dim IEWin As Object
Dim IEShell As Object
Set IEo = CreateObject("InternetExpl orer.Appli cation")
IEo.Navigate2 "http://www.speedeedelivery.com/pod.html"
Do While IEo.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
IEo.Visible = True
Set IEShell = CreateObject("Shell.Applic ation")
Set IEShell = IEShell.Windows
For Each IEWin In IEShell
On Error Resume Next
If IEWin.Application.Document .Title = "Spee-Dee Delivery - Proof of Delivery" Then
IEWin.Application.Document .Forms("lo gin_form") .Elements( "shipperno ").Value = "Shipper No"
IEWin.Application.Document .Forms("lo gin_form") .Elements( "login_pas sword").Va lue = "password"
IEWin.Application.Document .Forms("lo gin_form") .Submit
End If
If Err Then
Err.Clear
End If
Next
Set IEo = Nothing
Set IEWin = Nothing
Set IEShell = Nothing
It opens the site but doesn't fill anything in and doesn't submit the form. Any ideas?
Thanks..
J_K_M_A_N
https://www.experts-exchange.com/questions/21378895/Web-pages-that-use-input-from-user.html
That solution worked for many web pages but I am having a problem with a few. Like the one below. It will open the page but it won't fill in any info. Am I doing something wrong? Is there some other code I should be using instead? Thanks for any help.
Dim IEo As InternetExplorer
Dim IEWin As Object
Dim IEShell As Object
Set IEo = CreateObject("InternetExpl
IEo.Navigate2 "http://www.speedeedelivery.com/pod.html"
Do While IEo.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
IEo.Visible = True
Set IEShell = CreateObject("Shell.Applic
Set IEShell = IEShell.Windows
For Each IEWin In IEShell
On Error Resume Next
If IEWin.Application.Document
IEWin.Application.Document
IEWin.Application.Document
IEWin.Application.Document
End If
If Err Then
Err.Clear
End If
Next
Set IEo = Nothing
Set IEWin = Nothing
Set IEShell = Nothing
It opens the site but doesn't fill anything in and doesn't submit the form. Any ideas?
Thanks..
J_K_M_A_N
Does the if statement fire? All of the statement look correct. Have you tried putting in a stop where the if statement fires to see exactly what the .title variable is actually holding?
Looking at the page you are getting. The problem appears to be with the IFrame. In IE open the page and then view source. You will notice that the form fields you are looking for are actually in a frame. Let me see If I can Get you something that will overcome this frame issue.
IEWin.Application.Document .Item("ifr ame1").for ms("login_ form").Ele ments("shi pperno").V alue = "Shipper No"
IEWin.Application.Document .Item("ifr ame1").For ms("login_ form").Ele ments("log in_passwor d").Value = "password"
IEWin.Application.Document .Item("ifr ame1").For ms("login_ form").Sub mit
Can you try something like this?
IEWin.Application.Document
IEWin.Application.Document
Can you try something like this?
ASKER
Nope. The Item("iFrame1") gets nothing either. I figure it is something like that though. I just can't seem to find it. Another thing I have tried was something like
IEWin.Application.Document .Forms("al l").Elemen ts("shippe rno").Valu e = "Shipper Number"
or something like that. It was suppost to fill in ALL of the "shipperno" fields in ALL forms. That didn't work either. Thanks for the try though. Any other ideas?
J_K_M_A_N
IEWin.Application.Document
or something like that. It was suppost to fill in ALL of the "shipperno" fields in ALL forms. That didn't work either. Thanks for the try though. Any other ideas?
J_K_M_A_N
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good job edward. I didn't even see that if your having problems line.
ASKER
Well, Thanks again Edward. Now I can give you more points. :)
I was looking through the HTML but I didn't pay ENOUGH attention to the main frames code. I was looking more at the login page code. What is funny is that if I had clicked on that, I can just pass the info directly in the address bar. I don't really need to control it this way.
I do feel like I should split the points somewhat though. sk33v3 did put in some work to help. I hope you don't mind. Thanks again for the help.
J_K_M_A_N
I was looking through the HTML but I didn't pay ENOUGH attention to the main frames code. I was looking more at the login page code. What is funny is that if I had clicked on that, I can just pass the info directly in the address bar. I don't really need to control it this way.
I do feel like I should split the points somewhat though. sk33v3 did put in some work to help. I hope you don't mind. Thanks again for the help.
J_K_M_A_N
I don't mind at all. Am always glad when members work to help answer questions, and sk33v3 was well on the way to finding the solution:)
ASKER
One thing though, did you say it works for you if you change it to title = "" in the framed page? Mine doesn't. It does work just fine if I use the other link though which I will probably do. I was just curious.
J_K_M_A_N
J_K_M_A_N
Well no it won't it will only work for that one page if you browse directly to the url that the frame contains. That page happens not to have a title.
BTW thanks for the points
ASKER
No problem. So what you are saying is, if it had a title, it MAY work in the frame? Would the code see the page in the frame as a seperate page? Because it looks for seperate instances of Internet Explorer so I was just wondering if it would see that page in that frame and try to match the caption of it.
J_K_M_A_N
J_K_M_A_N
Yes Code wise the program will see the page as a seperate page. Unfortunately I am not sure if there is a way to actually directly access the a frame within a page. There might be using the documents object but I am not sure. Unfortunately I don't believe it will actually pick up the iframe in the fashion you are thinking it might.