简体   繁体   中英

How to click a button on website via c# on wp7

I need to click a button on a website. The button in html: <input class="btn" type="submit" value="Войти" />

wp7 webBrowser do not support webBrowser.Document, so I can't use

foreach(HTMLElement html in webBrowser.Document.GetElementByTagName("input"))
{
 if(html.GetAttribute("value) == "Войти")
html.InvokeMember("submit");
}

also button has no id or tag, so I cant use "getElementsById" or "getElementsByTag"

您使用Javascript填写字段,只需以相同的方式提交表单即可:

wb1.InvokeScript("eval", "document.forms[0].submit();");

With the HTML5 Windows Phone application the default order of Browser.Navigate(...) then Browser.IsScriptEnabled = true; does not work. You need to have the Browser.IsScriptEnabled = true; before the Navigate() call.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM