Vijeet Deliwala
Vijeet Deliwala

Reputation: 115

Xpath with specific child and parent Classes

Suppose the following HTML

< div class="entry" >
    < div class="partial_entry" >
    Hello
    < /div>
< /div> 

I want to select Hello using Xpath...Select all elements with class partial_entry where parent is of class entry..

Upvotes: 2

Views: 4946

Answers (2)

Johnny
Johnny

Reputation: 164

In Chrome Dev Tools or Firebug, in their DOM views("HTML" bookmark in Firebug and "Elements" bookmark in Chrome Dev Tools) you can quickly get an element xpath by righ-clicking it and selecting "copy XPath".

Upvotes: 2

Try this:

    //div[@class='entry']/div[@class='partial_entry']/text()

Upvotes: 4

Related Questions