Sign in to follow this  
Followers 0
allcapone1912

FFXpath get all by div class

4 posts in this topic

hi,

need some help

i use FFXpath to get text by div class but i have a problem

the page have more than one div class = data_field_value and i want to get them all

with my current code i get only the first text

$sText = _FFXpath("//div[@class='data_field_value']", "textContent", 2)
 
 
can someone help me to get all text from div class 'data_field_value'
 

Share this post


Link to post
Share on other sites



Look at the documentation for _FFXPath and the included examples. Changing the value of the 3rd parameter lets you adjust the return type.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$xml = "<xml><div class='data_field_value'>test1</div><div class='data_field_value'>test2</div></xml>"

$oXML = ObjCreate("Microsoft.XMLDOM")
$oXML.loadXML($xml)
$oDivs = $oXML.selectNodes("//div[@class='data_field_value']")
For $oDiv In $oDivs
    ConsoleWrite($oDiv.text & @CRLF)
Next

Output:

test1

test2

Edited by jdelaney
1 person likes this

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

$xml = "<xml><div class='data_field_value'>test1</div><div class='data_field_value'>test2</div></xml>"

$oXML = ObjCreate("Microsoft.XMLDOM")
$oXML.loadXML($xml)
$oDivs = $oXML.selectNodes("//div[@class='data_field_value']")
For $oDiv In $oDivs
    ConsoleWrite($oDiv.text & @CRLF)
Next

Output:

test1

test2

thanks,its work

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0