I need to select/click an item from the table. I'm new/beginner to selenium. when I inspect the individual property, it has:

<a id = "rpn" style=”cursor: pointer”, ng-click=”grid.appScope.viewEvent(row.event, $event)” ng-show=”row.entity.organization !== ‘Restricted’ “class=”ng-binding ng-scope” aria-hidden=”false”>123456</a> == $0
<span ng-show=”row.entity.organization === ‘Restricted’” class=”ng-binding ng-scope ng-hide” aria-hidden=”true”>123456</span>

123456 is number and link will open a page. When I’ve tried to find the CSS Selector – Got “#rpn” , When I’ve tried to find the xpath – got //*\@id=”rpn”] - I could not use xpath because of quotes around rpn. All the links in a table have the same XPath, CSS selector, link address except number. And, it is a random number too.

The entire table has property of:

<div role ="rowgroup" class="ui-grid-viewport ng-isolate-scope" ng-style="container.getViewportStyle()" ui-grid-viewport style="overflow:hidden;"> == $0 

I need to click that first number and move on to the next testing. Not sure how to identify the property and select it. If you need any info please let me know. Any help would be great.

  • "I could not use xpath because of quotes around rpn" - what do you mean?
    – wec
    Oct 24, 2019 at 15:18
  • Can you add the source code and/or image of the website?
    – Lee Jensen
    Oct 24, 2019 at 15:18
  • Try this: //*@id=\”rpn\”] - if this works, I will convert it to an answer.
    – Brian
    Oct 24, 2019 at 15:30

1 Answer 1


I don't see all html So I'm guessing that you can try:

1/ id: WebElement elementName = driver.findElement(By.Id("rpn"));

2/ Xpath:

  • //a[text()='123456']

  • OR //a[@id='rpn' AND text()='123456']

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.