找回密码
 加入
搜索
查看: 2243|回复: 3

[IE类操作] 如何打开网页中的固定链接(完了,结吧)

[复制链接]
发表于 2011-4-25 16:36:43 | 显示全部楼层 |阅读模式
本帖最后由 lluxury 于 2011-5-1 08:05 编辑

在类似http://abc/wx.main.asp这种网页的源码里,看到些固定不变的链接

哪如何点击网页中的连接呢 ,类似这样的 <a href='main.asp?mode=action&method=itemuse&pos=1'>[使用]</a>
发表于 2011-4-25 17:46:03 | 显示全部楼层
先读取htm内容,再用正则提取链接。
$link="<a href='main.asp?mode=action&method=itemuse&pos=1'>[使用]</a>"
$aLink=stringregexp($link,"href='([^']+)'",3)
for $i=0 to ubound($aLink)-1
msgbox(0,'',$aLink[$i])
next
 楼主| 发表于 2011-4-25 17:51:17 | 显示全部楼层
谢谢楼上,不过我是要运行这个连接 ,_IELinkClickByText 函数好像不能用于au3,不知道还有别的方法没
 楼主| 发表于 2011-5-1 08:04:48 | 显示全部楼层
本帖最后由 lluxury 于 2011-5-1 08:11 编辑

#include <IE.au3>
$oIE = _IECreate("http://search.china.alibaba.com/selloffer/rfid/1.html?max_cat_id=1033180&offset=2",0,1,1,0)

Dim $string = '', $i = 0
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
        If StringInStr($oLink.href, 'javascript:')<> 0 Or StringInStr($oLink.href, 'game.htm')<> 0 Then
                       
                If StringInStr($string, $oLink.href) Then
                        _IEAction($oLink, 'click')
                        ContinueLoop
                Else
                        $i += 1
                        $string &= $i & '=' & $oLink.href & @CRLF
                EndIf
        EndIf
Next

MsgBox(64, "Link Info", '共有"谈生意"链接:' & $i & @CRLF & $string)



哎,解决问题都要我自问自答么,感觉来论坛提问都没什么必要了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-9 10:20 , Processed in 0.086147 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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