# Select a Web element by it's text content

**URL:** <https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673>\
**Category:** Get Help & Discuss\
**Created:** [November 3, 2020, 1:05pm UTC](https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673 "2020-11-03T13:05:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NipunA](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@NipunA](https://community.automationedge.com/u/NipunA)\
**Post date:** [November 3, 2020, 1:05pm UTC](https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673/1 "2020-11-03T13:05:15Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![fbaldin](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/fbaldin/32/99_2.png) [@fbaldin](https://community.automationedge.com/u/fbaldin)\
**Post date:** [November 4, 2020, 9:34pm UTC](https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673/2 "2020-11-04T21:34:58Z")

</div>

Hi @NipunA use this XPath:

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

Also check this link:

> **[XPath in Selenium WebDriver: Complete Tutorial](https://www.guru99.com/xpath-selenium.html)**

---

<div class="post-metadata">

**Author:** ![NipunA](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@NipunA](https://community.automationedge.com/u/NipunA)\
**Post date:** [November 5, 2020, 7:02am UTC](https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673/3 "2020-11-05T07:02:07Z")

</div>

Hi @fbaldin

it didn’t work still getting the error:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/automationedge/original/1X/82432017b58eabd9963ccf558e5f12f2d78e1f0e.png)

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/automationedge/original/1X/4b6b83d62d9f8b98c953660116ae90d1a50c90ca.png)

any further help is much appreciated.

---

<div class="post-metadata">

**Author:** ![NipunA](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@NipunA](https://community.automationedge.com/u/NipunA)\
**Post date:** [November 5, 2020, 11:53am UTC](https://community.automationedge.com/t/select-a-web-element-by-its-text-content/2673/4 "2020-11-05T11:53:44Z")

</div>

@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.
