0

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.

alecxe
11.4k11 gold badges52 silver badges107 bronze badges
asked Oct 24, 2019 at 15:12
3
  • "I could not use xpath because of quotes around rpn" - what do you mean? Commented Oct 24, 2019 at 15:18
  • Can you add the source code and/or image of the website? Commented Oct 24, 2019 at 15:18
  • Try this: //*@id=\"rpn\"] - if this works, I will convert it to an answer. Commented Oct 24, 2019 at 15:30

1 Answer 1

2

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']

answered Nov 7, 2019 at 1:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.