How do I get all of the innerText from a webpage? - Using the code below only gets the first line, the \"Paragraph\" tag stops this read. I\'d be oka
Here is a sample of the method I used to find all the tags I needed to scrape, click and send information from a webpage to myself as well as logging in and doing other routine processes like entering information instead of having to do it manually. With this you can build more complex proceedures using instr statements to figure out what you want to search for, click, etc without having to actually do anything manually so that, for example, if microsoft or some other company keeps changing the java script button tag you can use text strings and offsets to click the button no matter what its name/tag is.
Sub BIG_EskimoRoll()
On Error Resume Next
Dim ExpR As Object
Set ExpR = ie.Document.getElementsByTagName("p")
i = 0
While i < ExpR.Length
If ExpR(i).Name <> "" Then
If ExpR(i).className = "expireFeature" Then msg = ExpR(i).innerText
''''this is good code to keep around'''''''''''
'If ExpR(i).className = "expireFeature" Then Debug.Print ExpR(i).className
'If ExpR(i).className = "expireFeature" Then Debug.Print ExpR(i).innerText
' Set text for search
Debug.Print "Ptsn: " & i
Debug.Print "Nm: " & ExpR(i).Name
Debug.Print "Type: " & ExpR(i).Type
Debug.Print "Vl: " & ExpR(i).Value
Debug.Print "ID: " & ExpR(i).ID
Debug.Print "inTxt: " & ExpR(i).innerText
Debug.Print "inHTML: " & ExpR(i).innerHTML
Debug.Print "outHTML: " & ExpR(i).outerHTML
Debug.Print "cNm: " & ExpR(i).className
Debug.Print "tNm: " & ExpR(i).tagName
Debug.Print "href: " & ExpR(i).href
End If
i = i + 1
Wend
End Sub