找回密码
 加入
搜索
查看: 2679|回复: 6

[AU3基础] AU3如何操作不典型的网页表单?[已解决]

  [复制链接]
发表于 2016-10-2 14:09:53 | 显示全部楼层 |阅读模式
本帖最后由 cashiba 于 2016-10-16 19:53 编辑


如上图。
  <form method="POST" class="quc-form">
   <p class="quc-field quc-field-account quc-input-long"><label for="quc_account_384028623" class="quc-label">帐   号</label><span class="quc-input-bg quc-input-bg-focus">
   <input id="quc_account_384028623" class="quc-input quc-input-account" name="account" placeholder="手机号/用户名/邮箱" autocomplete="off" type="text" /></span></p>
   <div class="quc-email-hint-wrapper">
    <div style="width: 228px; display: none;" class="quc-email-hint">
     <a style="display: block;" tabindex="-1" href="#">@sina.com</a>
     <a style="display: block;" tabindex="-1" href="#">@163.com</a>
     </div>
   </div>
   <p></p>
   <p class="quc-field quc-field-password quc-input-long"><label for="quc_password_384028624" class="quc-label">密   码</label><span class="quc-input-bg">
   <input id="quc_password_384028624" class="quc-input quc-input-password" name="password" maxlength="20" placeholder="请输入您的密码" type="password" /></span></p>
   <p class="quc-field quc-field-captcha quc-input-short clearfix"><label for="quc_phrase_384028625" class="quc-label">验证码</label><span class="quc-input-bg"><input id="quc_phrase_384028625" class="quc-input quc-input-captcha" name="phrase" maxlength="7" autocomplete="off" placeholder="请输入验证码" type="text" /></span><img class="quc-captcha-img quc-captcha-change" alt="验证码" title="点击更换" tabindex="99" /> <a class="quc-link quc-captcha-change-link quc-captcha-change" href="#">换一张</a></p>
   <p class="quc-field quc-field-keep-alive"><label><input class="quc-checkbox quc-checkbox-keep-alive" name="iskeepalive" type="checkbox" />下次自动登录</label></p>
   <p class="quc-field quc-field-submit">
   <input value="登录" class="quc-submit quc-button quc-button-sign-in" type="submit" /> </p>
   <p style="display: none;" class="quc-field quc-field-third-part"><span>其他帐号登录:</span><span class="quc-third-part"></span></p>
  </form>
最近学学AU3操作网页DOM。但是不少函数看不懂,也不会用.....
现在练习,想弄个自动登录http://yunpan.360.cn/,但是发现:
1、表单<form>无Name,无ID
2、登录按钮无Name,无图片

如何套用下方代码呢?
#include <IE.au3>
Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetObjByName($oIE, "gbqf")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2016-10-4 09:00:56 | 显示全部楼层
验证码你怎么弄
 楼主| 发表于 2016-10-7 21:07:40 | 显示全部楼层
这是子页吧?
zhao_ming 发表于 2016-10-7 14:05

是的,网页源代码中下面这段提示了表单位置:
<div class="login-panel">
<h1>欢迎使用360云盘!</h1>
<div id="login"></div>
<div class="change"></div>
</div>
发表于 2016-10-7 22:04:28 | 显示全部楼层
本帖最后由 cxlater 于 2016-10-7 22:07 编辑


#AccAu3Wrapper_UseX64=n                                                                                ;是否编译为64位程序(y/n)
#NoTrayIcon
#include<IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 859, 548, 192, 114)
$oie = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 0, 0, 857, 545)
GUISetState(@SW_SHOW)
_IENavigate($oie ,"https://yunpan.360.cn/")
$user = _IEGetObjByName($oie ,"account")
$pass = _IEGetObjByName($oie ,"password")
$loginbtn = _IETagNameGetCollection($oie ,"input" ,4)
$user.value = "testname"
$pass.value = "testpass"
$loginbtn.click
Do
        Sleep(50)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
发表于 2016-10-9 18:13:07 | 显示全部楼层
万变不离其宗,au3的用户自定义函数仅提供了一些常用的功能,想实现更复杂的功能还要对前端知识多了解一点。
 楼主| 发表于 2016-10-14 15:33:37 | 显示全部楼层
cxlater 发表于 2016-10-7 22:04

$loginbtn = _IETagNameGetCollection($oie ,"input" ,4)
通过标签索引定位,以前对这个很不熟悉,看到这个例子总算明白了,感谢,感谢!
 楼主| 发表于 2016-10-14 15:51:28 | 显示全部楼层
万变不离其宗,au3的用户自定义函数仅提供了一些常用的功能,想实现更复杂的功能还要对前端知识多了解一点。 ...
nmgwddj 发表于 2016-10-9 18:13

要学的东东太多了,没人指点的话,一个人琢磨,常常是不得要领,甚至钻进牛角尖,....所以希望论坛人气旺些,再旺些,学习得才快....
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 13:46 , Processed in 0.092927 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表