C# Fill Web Controls - Need Some Help

seoweb

Registered Member
Joined
Jan 20, 2009
Messages
85
Reaction score
28
hello,
i have small browser (c# ) with a webbrowser control.

and a button fill login:

that button fills the webform with my login details:

for example is working good for my mail on yahoo, i don't need to write the username/pass... just click fill and then click on login ( haven't yet succeeded to click from c# )

but on other websites i have some problems because they use an popup ( iframe/ frame with the input fields....).

for example http://www.yellowpages.com/ i can't fill the login form.

i tried:

HtmlElementCollection tagsCollection = getCurrentBrowser().Document.Window.Frames[0].Document.GetElementsByTagName("input");
foreach (HtmlElement currentTag in tagsCollection)
{
currentTag.SetAttribute("value", "eureka");
}

but i can't pass the "0x80070005 (E_ACCESSDENIED))"

i really, really need some help.


Thank you!
 
You are trying to access a http iframe redirected to a https form from a http page.
Basically, its not possible for security reason.

But... {see my next post}
 
Not sure what you want to do exactly but, you can try to open a new browser window directly to the login form {https[...]/login}
Go back to site home, your user will be logged.

Or, you can try to convert IHTMLWindow2 to IServiceProvider, then use IServiceProvider to get IWebBrowser2 object. Then, you'll access to the DOM from IWebBrowser2.
You can find many samples on the net.
 
Last edited:
get the link of that redirect and open it in webbrowser control instead. after you finish login you can open your main link.
 
Not sure what you want to do exactly but, you can try to open a new browser window directly to the login form {https[...]/login}
Go back to site home, your user will be logged.

Or, you can try to convert IHTMLWindow2 to IServiceProvider, then use IServiceProvider to get IWebBrowser2 object. Then, you'll access to the DOM from IWebBrowser2.
You can find many samples on the net.



thank you for answer, i will need to find IHTMLWindow2 solution because there are , manny websites that use popup iframes, and not only for the login....

basically i want my alternative for roboform in this way...


thank you all for answers
 
Actually, this can be done.

For the YP.com website login:

You will need to first get the HtmlElement of id "yp-main-login-link" for the sign in link. After you got that element found, you then need to click it using element.InvokeMemeber("Click").

Now you will have the pop up window appear, you now need to get the HtmlElement of id "user_password" & "user_user_name" then set the innerHtml to your username and password strings.

Now all we need to do is click the Submit button, you need to collect all HtmlElements with type "input", after you have objects you need to parse threw them. You then do a string check, like... if(elmcollection.GetAttribute("value").Contains("Sign In")), if that is detected, then proceed to click the button... elmcollection.InvokeMember("Click")

Hope this helps and isn't too crazy sounding. :D goodluck. My syntax may be a little different since I use c++.
 
Last edited:
I think that opening up the login form in a web control will be the best most reliable way of doing it.
 
Back
Top