Reputation: 33
I am making a program that finds the source URL of a video from the website, www.clicktoview.org. I can download the captcha it requires, and display it, but I can't solve it with the user's input because the text box on the website doesn't have a value=""
attribute.
Here is the relevant part of the HTML code:
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field">
With this hindrance, is there any way I can input the user's captcha interpretation to the text field?
My code would be
WebBrowser1.Document.GetElementById("recaptcha_response_field").SetAttribute("value", TextBox2.Text)
but there isn't a value
attribute.
N.B. The website is http://clicktoview.org/jbs2xyb89uai
Thanks for any help!
Upvotes: 0
Views: 9540
Reputation: 220
There isn't anything wrong with your code.
WebBrowser1.Document.GetElementById("recaptcha_response_field").SetAttribute("value", TextBox2.Text)
should do what you want. Even if a htmlElement doens't have a written value="" field you could still set it.
Have you checked to see that the GetElementById("recaptcha_response_field") returns a valid htmlElement?
Dim htmlElement As HtmlElement = WebBrowser1.Document.GetElementById("recaptcha_response_field")
If htmlElement IsNot Nothing Then
htmlElement.SetAttribute("value",TextBox2.Text)
End If
Upvotes: 1