Select a Web element by it's text content

How can we Select a Web element by it’s text content. for example if the element is:

" span class=“DocumentListColumns_homeownerName__2Slkn” role=“button” tabindex=“0”>BP New Berlin - #1308</span "

how can we select it in the Web click Plugin based on the text: “BP New Berlin - #1308

Hi @NipunA use this XPath:

//*[contains(text(),“BP New Berlin - #1308”)]

Also check this link:

Hi @fbaldin

it didn’t work still getting the error:

Although I can find the element , when I inspect the page and search with this expression:

any further help is much appreciated.

@fbaldin
I realized there was a frame that I wasn’t switching to. I did a switch frame and then used web click with our expression as our X-Path and it worked.

Thank for the help Fernando.

1 Like