Sign in to follow this  
Followers 0
Neeeewbie

Seaching for text inside a IE div class

3 posts in this topic

Hello, I'm trying read some IE page source code lines.

 

simplified source code looks like:

 

<div class=items-grid">

....blah blah blah

<div>  <-start of first name div

<Strong class="Card__name">name</strong>

....blah blah blah

</div>    <-end of first card div

<div>  <-start of 2nd name div

<Strong class="Card__name">name2</strong>

....blah blah blah

</div> <- end of 2nd name div

</div>     <- End of <div class=items-grid">

 

How wound I look in div class=items-grid and search for the Strong class="Card__name" text? 


Not asking for the full script just point me at something that can get me started and I'll be happy.

Share this post


Link to post
Share on other sites



Try this.. with strong... and class="Card__name"

#include <IE.au3>
#include <MsgBoxConstants.au3>


$oIE = _IECreate ("http://www.google.com", 0, 0, 1, 0)

$target = ""

$tags = $oIE.document.GetElementsByTagName("div")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "logo-subtext" Then
    $target = $tag
        ConsoleWrite("Tag Found " & $target.outerText&@CRLF)
    ExitLoop

EndIf
Next

_IEQuit ($oIE)

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You can use an xpath, in my signature function...

something like //div[@class='items-grid']/Strong

Then get the attribute value of classname.

Edited by jdelaney

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

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