Fill html textarea with c# webbroser
I need to fill textarea u开发者_开发技巧sing webbrowser. I can't use getElementByID as there's no id in textarea, just name, here's textarea code:
<textarea name="txt1"></textarea>
thanks..
If you cannot get elements by ID, you can always iterate elements by tagname
foreach (HtmlElement element in webBbrowser1.Document.GetElementsByTagName("textarea"))
{
// access text area element here
}
You could try something like this:
var elements = document.getElementsByName("txt1");
if (elements.length > 0){
var txt = elements[0];
if (txt){
txt.value = "Hi";
}
}
精彩评论