【发布时间】:2013-04-03 23:59:37
【问题描述】:
网站显示基于表格的选项供您选择。 HTML是
<td width="33%" class="cont"><input type="radio" name="gatewayIDV" onclick="setBank(11,0,1)">
<td width="33%" class="cont"><input type="radio" name="gatewayIDV" onclick="setBank(3,0,1)">
我想调用字符串“setBank(11,0,1)”的单选按钮。我如何能?所有收音机名称都相同,但onclick() 参数不同。
在 JavaScript 中有人会这样做,这里有一些代码,但我如何在 c# 中做到这一点
我尝试了这个但从来没有工作:
if (webBrowser1.DocumentText.IndexOf("setBank(11,0,1)", StringComparison.InvariantCultureIgnoreCase) > 1)
{
webBrowser1.Document.GetElementById("gatewayIDV").InvokeMember("click");
}
JavaScript:
$("td.cont").each(function(index) {
var $this = $(this);
var gonext = true;
if($this.html().search(searchStr) != -1) {
$(document).BookingEngine("setAutomationRunningStatus",
!tabData.automationRunning);
console.log(index+":"+$this.html()+":");
$this.children("input[name='gatewayIDV']").click();
gonext = false;
}
return gonext;
});
【问题讨论】:
-
你能给我测试结果的目标网址吗?
-
网站登录要求。我如何联系你并提供详细信息
标签: c# javascript winforms webbrowser-control invokemember