0

私は次の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>

属性が「postrow」または「postrow」のすべての DIV を選択するためのxpath文字列は何ですか

4

1 に答える 1

2

""この回答は、各について、実際にドキュメントに含まれていることを前提としてい"ます。

利用可能な代替 XPath が多数あります。ここに2つだけあります:

  • 条件付きの使用|:

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

  • 使用starts-with:

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

于 2013-06-16T04:51:23.480 に答える