am using this code to split text from listbox :
For Each Item As Object In ListBox1.SelectedItems
TextBox2.AppendText(Item.ToString + Environment.NewLine)
Next
Dim str As String = TextBox2.Text
Dim leftPart As String = str.Split(":")(0)
Dim test As String = TextBox2.Text
Dim phrase As String = test.Substring(test.IndexOf(":"c) + 1)
and this code to submit the value to html textbox
WebControl1.ExecuteJavascript("document.getElementById('email').value=""" + leftPart + """;")
Dim leftpar2 As String
leftpar2 = phrase
MsgBox(phrase)
Try
WebControl1.ExecuteJavascript("document.getElementById('pass').value=""" + leftpar2 + """;")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
The textbox with id (email) work fine
but the other one ( pass ) always get empty , I've tried to popup the value of ( phrase ) it get the correct value
I've tried to assign string to variable ( phrase )
Dim phrase As String = "test"
it work fine , can somebody tell me what am doing wrong ?
Well, I have download that component and went through your way
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (TextBox1.Text.Length < 3 Or TextBox1.Text.IndexOf(":") < 1) Then
MsgBox("Please type value in format like {email:password}")
Return
End If
' Get the values and parse it
Dim sources As String() = TextBox1.Text.Split(":")
' Now, we try to set it to page
' pay attention at `document.querySelector('#id')` it should be ID of the element
WebControl1.ExecuteJavascript(String.Format("document.querySelector('#email').value = '{0}'", sources(0)))
WebControl1.ExecuteJavascript(String.Format("document.querySelector('#password').value = '{0}'", sources(1)))
End Sub
And here's my login page code (the page which loads in WebControl component)
<body>
<input type="email" id="email" />
<input type="password" id="password" />
<button id="loginButton">Login</button>
</body>
Everything seems to be working
You can run my example: drop textbox, webcontrol and button on form, set WebControl1.Source as 'http://cafe-ht.ml/fake/fake-login.html' and copy handler on button click