Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm working with the WebKitBrowser in C# (Visual Studio 2010) and I want to automatically create a user in the web application of owncloud.
The login form is displayed in Picture 1. By clicking "Gruppen" a dropdown field with checkboxes appears (Picture 2). The html-code is below:
HTML
<form id="newuser" autocomplete="off">
<input id="newusername" type="text" placeholder="Loginname" /> 
<input type="password" id="newuserpassword" placeholder="Passwort" /> 
<select class="groupsselect" id="newusergroups" data-placeholder="groups" title="Gruppen" multiple="multiple">
	<option value="Benutzer">Benutzer</option>
	<option value="admin">admin</option>
</select> 
<input type="submit" value="Anlegen" />
</form>

I'm able to fill the newusername and newuserpassword textboxes and submit the form, for example:
C#
String javascript = "document.getElementById('newusername').value = '" + newusername + "';";
WebKitBrowser1.StringByEvaluatingJavaScriptFromString(javascript);

But I'm not able to select a value in newusergroups (Picture 2), for example:
C#
String javascript = "document.getElementById('newusergroups').options[1].selected = true;";
String javascript = "document.getElementById('newusergroups').value = 'admin';";

Maybe someone can help me? Thanks in advance and best regards,

Oli
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900