Webbrowser的新问题

northwolves 2009-08-07 11:31:12
Webbrowser 加载http://www.diamondwave.com/-strse-template/diamondsearch-dsh-advanced/Page.bok之后,如何设置Carat Weight的值为1-2 并连续翻看1-5页?
下面的代码没反应:
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.diamondwave.com/-strse-template/diamondsearch-dsh-advanced/Page.bok"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim yy
Set yy = WebBrowser1.document.getElementById("vfvSlider")
yy.Value = yy.Value + 1
WebBrowser1.document.parentWindow.execScript "javascript:void(false);"
If yy.Value = 5 Then Exit Sub
End Sub
...全文
168 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2009-08-09
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 ldy888 的回复:]
再来个一步到位的 ,设置Carat Weight的值为1-2, 一下翻到25页
同样的页面元素位置无变化,但值都是正确的,和手工拖到25 页的内容一样,但快 几十倍
刷新页面,页面元素位置的变化就看到了
VB code
s="D_centerstoneweightSliderChange('vfD_centerstoneweightSlider',1,0,1);D_centerstoneweightSliderChange('vfD_centerstoneweightSlider2',2,0,2);vSliderChange('vfvSlider',25,1);WebBrowser1.document.parentWindow.execScript s
[/Quote]

Excellent!!! 非常好使。
ldy888 2009-08-08
  • 打赏
  • 举报
回复
先去宵夜,回来再看
ldy888 2009-08-08
  • 打赏
  • 举报
回复
对 “如何设置Carat Weight的值为1-2 ” 这个说明,不理解

不知到这样对不对,下面的代码可以翻到 Page 5 of 114

Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.diamondwave.com/-strse-template/diamondsearch-dsh-advanced/Page.bok"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim yy As Object
Set yy = WebBrowser1.Document.all("arcvSlider") '.all(0)
If yy Is Nothing Then Exit Sub
Debug.Print WebBrowser1.Document.all("vfvSlider").Value
For i = 1 To 4
yy.all(0).onmousedown
yy.all(0).onmouseup
Next
Debug.Print WebBrowser1.Document.all("vfvSlider").Value
End Sub
贝隆 2009-08-08
  • 打赏
  • 举报
回复
学习
hunterhu3000 2009-08-08
  • 打赏
  • 举报
回复
页面上点滚动条其实是调用了一个js,你可以在webbrowser里面手工调用那个js
dingyanwei 2009-08-08
  • 打赏
  • 举报
回复
老外整的东西都很个性啊
aguangkj 2009-08-08
  • 打赏
  • 举报
回复
学习啊,我也在写一个程序,目前也要用到自动翻页
wuwenchun168 2009-08-08
  • 打赏
  • 举报
回复
学习中~~~~~·
goosen 2009-08-08
  • 打赏
  • 举报
回复
帮顶
ldy888 2009-08-08
  • 打赏
  • 举报
回复
再来个一步到位的 ,设置Carat Weight的值为1-2, 一下翻到25页
同样的页面元素位置无变化,但值都是正确的,和手工拖到25 页的内容一样,但快 几十倍
刷新页面,页面元素位置的变化就看到了

s ="D_centerstoneweightSliderChange('vfD_centerstoneweightSlider',1,0,1);D_centerstoneweightSliderChange('vfD_centerstoneweightSlider2',2,0,2);vSliderChange('vfvSlider',25,1);
WebBrowser1.document.parentWindow.execScript s
ldy888 2009-08-08
  • 打赏
  • 举报
回复
如何设置Carat Weight的值为1-2 这个明白了。
滚动条让人吐血,以下代码可以达到目的,但页面上的蓝色横杠,位置不动,不影响取值

Private Sub CommandButton1_Click()
Dim dmt As HTMLDocument
Set dmt = WebBrowser1.Document
Dim yy As Object
Set yy = WebBrowser1.Document.all("arcvSlider") '.all(0)
If yy Is Nothing Then Exit Sub
v1 = "1" ' 数字结尾不能有 0
v2 = "2"
s3 = "*Attribute1Values <= " & v2 & " && Attribute1Values >= " & v1 & "*"
s = "javascript:D_centerstoneweightSliderChange('vfD_centerstoneweightSlider'," & v1 & ",0,1);D_centerstoneweightSliderChange('vfD_centerstoneweightSlider2'," & v2 & ",0,2);D_centerstoneweightSliderEnd('vfD_centerstoneweightSlider2'," & v2 & ",0)"
Set t = dmt.all("returnByoDiamonds")
ss = t.innerText
Debug.Print ss

If Not ss Like s3 Then
dmt.parentWindow.execScript s ' 滚动条的值 如何设置Carat Weight的值为1-2
ss1 = ss
Do While Not ss1 Like s3
DoEvents
Set t = dmt.all("returnByoDiamonds")
ss1 = t.innerText
Loop
End If
'翻页 11楼的代码可以合并
'Me.WebBrowser1.Document.parentWindow.execScript "Bs_Objects[8].onChangeByArrow(true, true);Bs_Objects[8].stopFireArrow()"
Set yy = WebBrowser1.Document.all("arcvSlider")
vul = WebBrowser1.Document.all("vfvSlider").Value + 5
Do While WebBrowser1.Document.all("vfvSlider").Value * 1 <> vul
yy.all(0).onmousedown
yy.all(0).onmouseup
Loop
End Sub
lyserver 2009-08-08
  • 打赏
  • 举报
回复
翻页代码如下:
Me.WebBrowser1.Document.parentWindow.execScript "Bs_Objects[8].onChangeByArrow(true, true)"
DoEvents
Me.WebBrowser1.Document.parentWindow.execScript "Bs_Objects[8].stopFireArrow()"
无·法 2009-08-07
  • 打赏
  • 举报
回复
有些好像限制了的,老老实实一页页点吧
孤月残影 2009-08-07
  • 打赏
  • 举报
回复
你不如加个定时器,设置间隔时间自动点击下一页,到达第5页时,时间停止。

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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