Jump to content
Sign in to follow this  
ikku

Get div that contains text

Recommended Posts

ikku

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
jdelaney

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
Blue_Drache

What website?


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

Share this post


Link to post
Share on other sites
ikku

_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
jdelaney

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.