Jump to content

Seaching for text inside a IE div class

Recommended Posts

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.

Link to comment
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)


_IEQuit ($oIE)


Link to comment
Share on other sites

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.
Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...