Piszę program, który ma za zadanie ułatwić życie osobom, które pozycjonują strony internetowe. Program ma za zadanie wypełnić formularz dodania strony do katalogu (nie wysyła tego formularza) i minimalizuje pracę użytkownika przy katalogowaniu tylko do wpisania tokenu, wybrania kategorii i wysłania formularza.
Oto kod, który ma wypelniać formilarz:
HtmlElement url1 = webBrowser1.Document.All["site"];
HtmlElement url2 = webBrowser1.Document.All["adres"];
HtmlElement title1 = webBrowser1.Document.All["title"];
HtmlElement title2 = webBrowser1.Document.All["nazwa"];
HtmlElement title3 = webBrowser1.Document.All["tytul"];
HtmlElement opis1 = webBrowser1.Document.All["description"];
HtmlElement opis2 = webBrowser1.Document.All["opis"];
HtmlElement tagi1 = webBrowser1.Document.All["keywords"];
HtmlElement tagi2 = webBrowser1.Document.All["kluczowe"];
HtmlElement tagi3 = webBrowser1.Document.All["slowa"];
HtmlElement mail1 = webBrowser1.Document.All["email"];
if (url1 != null)
{
webBrowser1.Document.All["site"].SetAttribute("value", site.Text);
}
if (url2 != null)
{
webBrowser1.Document.All["adres"].SetAttribute("value", site.Text);
}
if (title1 != null)
{
webBrowser1.Document.All["title"].SetAttribute("value", title.Text);
}
if (title2 != null)
{
webBrowser1.Document.All["nazwa"].SetAttribute("value", title.Text);
}
if (title3 != null)
{
webBrowser1.Document.All["tytul"].SetAttribute("value", title.Text);
}
if (opis1 != null)
{
webBrowser1.Document.All["description"].SetAttribute("value", description.Text);
}
if (opis2 != null)
{
webBrowser1.Document.All["opis"].SetAttribute("value", description.Text);
}
if (tagi1 != null)
{
webBrowser1.Document.All["keywords"].SetAttribute("value", keywords.Text);
}
if (tagi2 != null)
{
webBrowser1.Document.All["kluczowe"].SetAttribute("value", keywords.Text);
}
if (tagi3 != null)
{
webBrowser1.Document.All["slowa"].SetAttribute("value", keywords.Text);
}
if (mail1 != null)
{
webBrowser1.Document.All["email"].SetAttribute("value", mail.Text);
}
Program wypełnia mi wszystkie pola typu input, natomiast jest taki mankament, że pola opis i słowa kluczowe są polami typu textarea. Jak mam wypełnić tego typu pole?
Próbowałem też zrobić:
webBrowser1.Document.All["description"].InnerText = description.Text;
ale wyrzuca mi błąd: System.NotSupportedException
Co mam zrobić, aby mi to jako tako wypelniało?