อาจารย์ครับ รบกวนถามต่อจากใน PM ครับ code ผมลองปรับจากของอาจารย์ดูจาก
Code: Select all
Try
Dim theElementCollection As HtmlElementCollection
theElementCollection = WebBrowser2.Document.All
For Each curElement As HtmlElement In theElementCollection
If curElement.GetAttribute("OuterHtml").Contains("btn-update abs") Then
curElement.InvokeMember("click")
'MsgBox("it does the job")
End If
Next
Catch exc As Exception
MsgBox(exc.Message)
End Try
ครับ ปรับตัวปุ่มใน Contains("btn-login.png") ซึ่งในหน้า
https://ini3netcafe.mygame.in.th/ipbonus หน้านี้นั้น จากการแงะดู source ของหน้าเว็บ ไม่สามารถ ระบุ ชื่อปุ่มได้ครับ มันมีแค่
Code: Select all
<li class="ip3"><div class="rel"><input type="text" class="box-ipbonus" maxlength="5" value="49.228.229.162">
<div class="btn-update abs" onClick="fn_ipbonus('49.228.229.162','update');"></div></div></li>
แค่นี้ครับ ซึ่งผมลองหา code จากเว็บนอกแล้ว โยลองทดสอบกับ code ที่กดจาก class โดยผมลองใช้ code นี้ครับ
Code: Select all
For Each element As HtmlElement In WebBrowser2.Document.GetElementsByTagName("input")
If element.GetAttribute("class") = "btn-update abs" Then
element.InvokeMember("click")
End If
Next
ซึ่งเมื่อลอง run ดู เกิด error ครับที่ GetElementsByTagName("input")โดยแจ้งว่า "Object reference not set to an instance of an object." ครับผม
ขอรบกวนอาจารย์อีกครั้งนะครับ
