Page 1 of 1

Website login?

Posted: Tue Jan 25, 2011 11:01 am
by Runar
I need help with website login and website combobox select.

First the login:
I know the basic code but i can't get it working:
Code: Select all
WebBrowser1.Document.GetElementById("login").SetAttribute("value", TextBox1.Text)
        WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", TextBox2.Text)

        WebBrowser1.Document.GetElementById(".save").InvokeMember("click")
Here is the website source:
Code: Select all
<div class="inputfields"> 
		<p><label for="username">Username</label> 
		<input class="inputtext" type="text" id="username" name="feidename"/></p> 
 
		<p><label for="password">Password</label> 
		<input class="inputtext" type="password" id="password" name="password" /></p> 
		<input type="hidden" name="AuthState" value="_fc32126b789a6cec39249912353790804c96664b54:https://idp.feide.no/simplesaml/saml2/idp/SSOService.php?spentityid=urn%3Amace%3Afeide.no%3Aservices%3Acom.fronter.sp&cookieTime=1295951803&RelayState=https%3A%2F%2Ffronter.com%2Ftromsvgs%2Fmain.phtml" /> 
		<input type="hidden" name="org" value="troms.vgs.no" /> 
		<input type="submit" class="submit" value="Login" /> 
		</div> 
and then the combobox selection:

I want to it select an item in the textbox and continue going to next page:

source:
Code: Select all
<div id="orgframe"> 
	<form action="?" method="get" name="f"> 
	<fieldset> 
		<legend>Choose affiliation</legend> 
		<select id="org" name="org"> 
		<option value="flesberg.kommune.no">Flesberg council</option><option value="skole.fredrikstad.no">Fredrikstad council</option><option value="luster.kommune.no">Luster council</option><option value="mrfylke.no">Møre and Romsdal County Council</option><option value="notodden.kommune.no">Notodden council</option><option value="oppland.org">Oppland County Council</option><option value="rollag.kommune.no">Rollag council</option><option value="sfj.no">Sogn and Fjordane County Council</option><option value="tinn.kommune.no">Tinn council</option><option selected="selected" value="troms.vgs.no">Troms County Council</option><option value="uia.no">University of Agder</option>		</select><br /> 
		<input type="hidden" name="AuthState" value="_fc32126b789a6cec39249912353790804c96664b54:https://idp.feide.no/simplesaml/saml2/idp/SSOService.php?spentityid=urn%3Amace%3Afeide.no%3Aservices%3Acom.fronter.sp&cookieTime=1295951803&RelayState=https%3A%2F%2Ffronter.com%2Ftromsvgs%2Fmain.phtml" />		<input type="submit" class="submit" name="submit" value="Continue »" /> 
                <div id="selectorghelp" class="loginhelp-static"><span>What is my affiliation?</span></div> 
                <div id="loginhelpframe"> 



Thanks hehaho;
Hope you can help!

-RunarM

Re: Website login?

Posted: Tue Jan 25, 2011 1:06 pm
by lesan101
i dont think the login button is ".save"

try this:
WebBrowser1.Document.GetElementById("submit").InvokeMember("click")

also, for your login credentials... i think it's also wrong..

try:
WebBrowser1.Document.GetElementById("username").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("password").SetAttribute("value", TextBox2.Text)