VB.NET - 点击的网页浏览器页面上提交按钮 [英] VB.NET - Click Submit Button on Webbrowser page

查看:132
本文介绍了VB.NET - 点击的网页浏览器页面上提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML页面我的web浏览器对象开放,我可以输入用户名和密码还好,但我坚持,不知道如何提交的信息。下面是HTML code的用户名/密码提交:

I have a html page open on my webbrowser object, I can enter username and password okay, but I'm stuck and don't know how to submit the info. Here is the html code for the username/password submit:

<div id="signin">
    <h2 class="ir">
        <em></em>Sign in</h2>
    <form action="/login/" method="post">
    <input id="login-url" name="login[url]" 
           type="hidden" value="/characters/" />
    <input id="login-urlError" name="login[urlError]" 
           type="hidden" value="/account/?error=1" />
    <fieldset>
        <ul>
            <li class="row">
                <label for="login-username">
                    Username <span class="req">*</span>
                </label>
                <input id="login-username" name="login[username]"
                        type="text" class="TextBox" value="" />
            </li>
            <li class="row">
                <label for="login-password">
                    Password <span class="req">*</span>
                </label>
                <input id="login-password" name="login[password]"
                       type="password" class="TextBox Password" value="" />
            </li>
            <li class="but">
                <input name="login[submit]" type="image" 
                       class="img" alt="Login &raquo;" 
                       src="/_pub/img/hp/but-login.png" />
            </li>
        </ul>
    </fieldset>
    </form>
    <p>
        <a href="/account/password-reset/">ACCOUNT TROUBLE?</a>
    </p>
</div>

我用下面输入用户名和密码:

I use the following to enter the username and password:

WebBrowser1.Document.GetElementById("login-username").SetAttribute("Value", Information.txtuser.Text)
WebBrowser1.Document.GetElementById("login-password").SetAttribute("Value", Information.txtpass.Text)

我应该用现在提交信息?我试图让名字的元素,并不断获得指数超出范围错误,索引应该是-1或0,但它是。

What should I use to submit the info now? I tried getting the element by name and kept getting index out of range error, index should be -1 or 0, but it was.

您帮助将不胜appriecated!

Your help would be greatly appriecated!!

推荐答案

WebBrowser1.Document.GetElementById(*元素ID字符串*)。InvokeMember(提交)

这篇关于VB.NET - 点击的网页浏览器页面上提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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