Sign in to follow this  
Followers 0
ikku

Get div that contains text

7 posts in this topic

Hello,

I've looking for all the forum and i didn't found the answer.

I'm creating and application and need to read the text of the html of one web and click in one input radio. This web has a lot of input and a want check what contain the text passed by parameter.

By example:

 

<div class="input_tex">one text <input button> </div>

<div class="input_tex">one text <input button> </div>

<div class="input_tex">MY TEXT!!!! <input button> </div>

<div class="input_tex">one text <input button> </div>

I want to check the input that is contained in the div with my text. Any idea?

Thanks!!!

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

You can use my sig...your xpath would be:

$xpath = "//div[.='MY TEXT!!!!']/input"

; or

$xpath = "//div[contains(.,'MY TEXT!!!!')]/input"

You can also validate the attribute, if required:

$xpath = "//div[@class='input_tex' And .='MY TEXT!!!!']/input"
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

What website?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

_IETagnameGetCollection

Loop

If Then EndIf

obj.innertext

Thanks!!

With this I can detect the div that contains the text. How to check the input button?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

When you find your object, loop through it's children (.childNodes) until you find the <input>...get that object, and click it with _ieaction (shameless plug: my first example, and signature, does all this, and returns the object...then you just need to call the _ieaction.)

Regardless, google IE DOM proprties and methods, and find all the different things you can do.

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