求助webBrowser网页操作

sadfhjke1 2011-09-27 08:18:42
我想写一个腾讯游戏的多开器省得每次都要手动复制黏贴账号密码,在网页中想获取一个元素,我知道能用webBrowser.Document.GetElementById("u"); 看了网页源文件元素代码为
<input type="text" class="inputstyle" id="u" name="u" value="" style="ime-mode:disabled" tabindex="1" />
但是用上述方法 无法取得到该网页元素!网页地址是game.zg.qq.com希望高手能够解答!
...全文
134 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yojinlin 2011-09-28
  • 打赏
  • 举报
回复
二、先從 game.zg.qq.com 網頁原始檔中會找到一個 iframe 的來源 http://ui.ptlogin2.qq.com/cgi-bin/login?appid=36000101&style=0&hide_title_bar=1&login_text='%u767B%20%u5F55'&hide_uin_tip=1&qlogin_jumpname=jump&qlogin_param=u1%3Dhttp%253A//game.zg.qq.com/index.html&s_url=http%3A//game.zg.qq.com/index.html&css=http://game.zg.qq.com/js/login.css
三、瀏覽 iframe 的網址後,經由類似下方的方式嘗試登入,登入成功後再返回你要的頁面。

this.webBrowser1.Navigate("http://ui.ptlogin2.qq.com/cgi-bin/login?appid=36000101&style=0&hide_title_bar=1&login_text='%u767B%20%u5F55'&hide_uin_tip=1&qlogin_jumpname=jump&qlogin_param=u1%3Dhttp%253A//game.zg.qq.com/index.html&s_url=http%3A//game.zg.qq.com/index.html&css=http://game.zg.qq.com/js/login.css");
...
...
HtmlDocument doc = this.webBrowser1.Document;
this.webBrowser1.Document.GetElementById("u").SetAttribute("value", "username");
this.webBrowser1.Document.GetElementById("p").SetAttribute("value", "password");
this.webBrowser1.Document.GetElementById("login_button").InvokeMember("Click");


ps.針對有 iframe 的頁面就先找到需要的 iframe 直接連,這樣比較單純。
Lexiaoyao20 2011-09-28
  • 打赏
  • 举报
回复
string id = webBrowser1.Document.GetElementById("id").InnerText;
yojinlin 2011-09-28
  • 打赏
  • 举报
回复
我有空幫你試試,我會再回覆你。
sadfhjke1 2011-09-28
  • 打赏
  • 举报
回复
表里有2个框架。。点那个输入QQ号得 附近查看网页源代码就有了
yojinlin 2011-09-27
  • 打赏
  • 举报
回复
我怎麼沒有看到下面這一個呀?
<input type="text" class="inputstyle" id="u" name="u" value="" style="ime-mode:disabled" tabindex="1" />
sadfhjke1 2011-09-27
  • 打赏
  • 举报
回复
有木有人懂呀。。
Gemini Dean 2011-09-27
  • 打赏
  • 举报
回复
帮顶一下!

110,526

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧