我要如何改变一个WebBrowser控件一个下拉框? [英] How do I change a dropdown box in a webbrowser control?

查看:199
本文介绍了我要如何改变一个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并确定在 ID DropDownList的,例如:

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控件使用预先选择的DropDownList值这个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天全站免登陆