Jump to content

Get div that contains text


ikku
 Share

Recommended Posts

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!!!

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
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
 Share

  • Recently Browsing   0 members

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