0
私はセレンのVBAでページを開いています。このページには同じクラス名の要素がたくさんあります。コード:People = driver.findElementByClass("labelinfo").Text
それは私のページに最初の要素を返し、私はコードを使用するので、私はコードを使用します:driver.findElementsByClassName("labelinfo").Count
とそれは27要素 "labelinfo"を持っていると言う。では、要素番号7に達するまでforループを使って要素を要素ごと "歩く"ことができますか? 私のコードは次のとおりです。セレンのvbaを使って同じクラス名のページの次の要素に移動する方法
Public Sub AbreELogaNoForum()
Dim i As Integer, MyPass As String, MyLogin As String, nome As String, data As String, carteira As String, guia As String, test As Long
Application.ScreenUpdating = False
redo:
MyLogin = Application.InputBox("Por Favor entre com o Login")
MyPass = Application.InputBox("Por favor entre com a senha")
If MyLogin = "" Or MyPass = "" Then GoTo redo
driver.Start "chrome", "http://rda.unimednc.com.br/"
driver.setImplicitWait 50000
driver.Open "http://rda.unimednc.com.br/"
driver.findElementById("login").SendKeys MyLogin
driver.findElementById("password").SendKeys MyPass
driver.findElementById("Button_DoLogin").Click
test = 7
Range("B1").Select
For i = 1 To 10
MsgBox ("Esperando")
'nome = driver.findElementByClass("labelinfo").Text
ActiveCell.Value = driver.findElementsByClassName("labelinfo").Count
ActiveCell.Offset(1, 0).Select
Next
End Sub
Public Sub FechaBrowser()
driver.stop
End Sub