0

I have the follwoing HTML:

<div class=""postrow first""> <h2 class=""title icon""> This is the title </h2> <div class=""content""> <div id=""post_message_1668079""> <blockquote class=""postcontent restore ""> <div>Category</div> line 1<br /> line2 </blockquote> </div> </div> </div> <div class=""postrow""> <h2 class=""title icon""> second title </h2> <div class=""content""> <div id=""post_message_1668079""> <blockquote class=""postcontent restore ""> <div>Category</div> line 1<br /> line2 </blockquote> </div> </div> </div> 

What is the xpath string to select all DIVs with attribute is "postrow" or "postrow "

3
  • 1
    That's not valid HTML. Commented Jun 15, 2013 at 19:26
  • Does //div[@class='postrow'] | //div[@class='postrow '] work? Commented Jun 15, 2013 at 19:46
  • 1
    Did you mean to type all of those double-double-quotes? Commented Jun 16, 2013 at 4:09

1 Answer 1

2

This answer assumes that for each "", you actually have " in your document.

There are a number of alternative XPaths available to you. Here are just two:

  • Using a conditional |:

    //div[@class = "postrow"] | //div[@class = "postrow "]

  • Using starts-with:

    //div[starts-with(@class, "postrow")]

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.