CSS>Element-id>Match>text



  • i need to click on an element. The text is "Activate"

    Previously I can just click on element-id, without specifying the text.
    Now the element id keeps changing ie different id for each login session.
    I cannot click on the element-id anymore.
    I think maybe i should match the text because the text does not change .. it is always "Activate"

    Upon inspection, the html for this text is
    <span class="status-text _spcontent-zha-10">Activate</span>

    I tried these but didn't work:

    CSS>Match>Activate
    Match>Activate

    How can I match and click?



  • @hifive said in CSS>Element-id>Match>text:

    i need to click on an element. The text is "Activate"

    Previously I can just click on element-id, without specifying the text.
    Now the element id keeps changing ie different id for each login session.
    I cannot click on the element-id anymore.
    I think maybe i should match the text because the text does not change .. it is always "Activate"

    Upon inspection, the html for this text is
    <span class="status-text _spcontent-zha-10">Activate</span>

    I tried these but didn't work:

    CSS>Match>Activate
    Match>Activate

    How can I match and click?

    Use the xpath text search selector

    //span[text()[contains(.,'Activate')]]
    

Log in to reply