1

I am willing to get the innerText and click on it. The text is Customer Service Inquiry.

I have tried:

.FindElementsByXPath("//*[text()[contains(.listItem, 'Customer Service Inquiry')]]").Click

This does not work as it gives error that it is not a valid xpath expression

Further, this works but I am wanting to click by what the inner text says.

.FindElementByXPath("//*[@id='listFav_ALLOUTSECURITY0000000000000000008276_APP_P4210_W4210E_PSG0021_20']").click

The html

<div id="listContentHolder"> == $0 > <div class="carolist" id="listOCL" slot="0" style="height: 57px; top: @px;">.</div> > <div class="carolist" id="listRecipts" slot="1" style="height: 57px; top: 57px;">.</div> <div class="caroList" id="listFav" slot="2" style="height: 153px; top: 114px;"> > <div class="listHeader expanded" id="listFavHeader" oncontextmenu="javascript:CARO.updateDropdownMenuView(this,event);jdebebGUIdoToggleSubMenu(this,'caroTabContextMenu', event, true)
;" toplistitem="false">.</div> <div id="listFavouter" class="listContentOuter" style="height: 128px;"> <div id="listFavInner" class="listContentInner" style="height: 128px; top: Opx;">
<div class="listItem" id="listFav_manageFavs" aria-labelledby="appCaption_fav_manageFavs" role="link" tabindex="0" style="user-select: none; top: Opx;">.</div> > <div class="listItem" id="listFav_ALLOUTSECURITY0000000000000000008582_APP_P4210_W4210E_PSG0099_10" aria-labelledby="appCaption_fav_ALLOUTSECURITY0000000000000000008582_APP_P4210_W 4210E_PSG0099_10" role="link" tabindex="0" style="user-select: none; top: 32px;">.</div> 

<div class="listItem" id="listFav_ALLOUTSECURITY0000000000000000008276_APP_P4210_W4210E_PSG0021_20" aria-labelledby="appCaption_fav_ALLOUTSECURITY0000000000000000008276_APP_P4210_W 4210E_PSG0021_20" role="link" tabindex="0" style="user-select: none; top: 64px;"> <table class="listItem"> 
<tbody>
<tr> > 
<td class="listIcon">.</td>
<td class="listText">Customer Service Inquiry</td> 
</tr> 
</tbody> 
</table> 
</div> 

<div class="listItem" id="listFav_21343ad6_1803cf57c8c__7ffeE1PDJAS3__APP_P41026_W41026E_PSA0001_30" aria-labelledby="appCaption_fav_21343ad6_1803cf57c8c__7ffeE1PDJAS3_APP_P41026_ W41026E_PSA0001_30" role="link" tabindex="0" style="user-select: none; top: 96px;">.</div> </div> <a class="panControl up" necessary="false" style></a>
<a class="panControl down" necessary="false" stylex/a> </div> </div> </div>

1 Answer 1

1

To click on the element with text as Customer Service Inquiry you can use either of the following locator strategies:

  • Using FindElementByXPath and only the innerText:

    .FindElementByXPath("//td[text()='Customer Service Inquiry']").click
    
  • Using FindElementByXPath along with the class and the innerText:

    .FindElementByXPath("//td[@class='listText' and text()='Customer Service Inquiry']").click
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.