gpt4 book ai didi

c# - 通过 WebBrowser 控件取消选中网页中的复选框

转载 作者:行者123 更新时间:2023-12-03 05:44:00 24 4
gpt4 key购买 nike

有没有办法取消选中/选中在网络浏览器控件中加载的网页中的复选框?谢谢。

更新:(这是我最初尝试过的,但没有成功)

HtmlDocument rememberme = this.webBrowser1.Document;
rememberme.GetElementById("remBox").SetAttribute("checked", "false");

最佳答案

您可以使用:

webBrowser.Document.InvokeScript

参见:

InvokeScript

这样你就可以调用 JS 函数来对页面执行你想要的操作。

另一种方法是使用 mshtml API,如下所示:( ( HTMLInputElement )this.webBrowser1.Document.GetElementById( "test").DomElement ).@checked = false;

关于c# - 通过 WebBrowser 控件取消选中网页中的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1680767/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com