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– wec2019年10月24日 15:18:22 +00:00Commented Oct 24, 2019 at 15:18
-
Can you add the source code and/or image of the website?Lee Jensen– Lee Jensen2019年10月24日 15:18:45 +00:00Commented Oct 24, 2019 at 15:18
-
Try this: //*@id=\"rpn\"] - if this works, I will convert it to an answer.Brian– Brian2019年10月24日 15:30:59 +00:00Commented 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']
Explore related questions
See similar questions with these tags.