Using Xpath Contains ID?

23,251
//div[contains(@id, "content-body")]

This means content-body in content-body-14269002-17290547

Normally, this will works.

Better:

//div[starts-with(@id, "content-body")]

This means the id attribute's value is started with content-body

Share:
23,251
Admin
Author by

Admin

Updated on February 13, 2020

Comments

  • Admin
    Admin about 4 years
    <div id="content-body-14269002-17290547">
    <p>...</p>
    <p>...</p>
    <p>...</p>
    <p>...</p>
    <p>...</p>
    </div>
    

    I Need To Select Everything in id = "content-body*"

    content-body changes on every Page, May Be Need to Use Wildcards ?