如何更改 webbrowser 控件中的下拉框? [英] How do I change a dropdown box in a webbrowser control?

查看:19
本文介绍了如何更改 webbrowser 控件中的下拉框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个我想更改的列表框,如下所示:

So I have a listbox I want to change, that looks like this:

如何更改七月的值?我需要将其 100% 自动化并将其更改为一月.我在各种网站上创建了很多帐户,需要将它们全部改回相同的生日.是的,我知道我必须找到它的 ID 等等.

How do I change the July value? I need this to be 100% automated and change it to January. I made a lot of accounts on various websites and need to change them all back to the same birthdate. Yes, I'm aware I'll have to find the ID of it, etc.

推荐答案

查看网站的 HTML 并识别下拉列表的 idvalues,例如:

View the HTML of the website and identify the id and values of the dropdownlist, for example:

<select id="bdayMonthId" size="1" name="bdayMonth">
    <option value="">Month</>
    <option value="Jan">January</>
    <option value="Feb">February</>
    <option value="Mar">March</>
</select>

要在 WebBrowser 控件中预先选择下拉列表值,请使用此 Winform 代码:​​

To pre-select the dropdownlist value in the WebBrowser control use this Winform code:

webBrowser1.Document.GetElementById("bdayMonthId").SetAttribute("value", "Feb");

这篇关于如何更改 webbrowser 控件中的下拉框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆