1

I'm currently trying to find a symbol on a page. I have the HTML tag and the find method that I'm using. However it's not able to find this symbol. I'm not sure what I'm doing wrong to do so.

<div class="ui-grid-selection-row-header-buttons ui-grid-icon-ok clickable bg-pristine bg-valid bg-scope bg-not-empty bg-touched" bg-class="{'ui-grid-row-selected': row.isSelected}" tabindex="0" bg-click="selectButtonClick(row, $event)" bg-keydown="selectButtonKeyDown(row, $event)" role="checkbox" bg-model="row.isSelected" aria-checked="true" aria-invalid="false">&nbsp;</div>

As you can see this is a weird html tag. I'm trying to avoid full xpath if possible.

Here is what I"m doing.

find(:css, "ui-grid-selection-row-header-buttons[button = 'selectButtonClick']")
Rubyman543
  • 165
  • 5
  • To solve the problem in a non-brittle fashion you really need to look at the HTML this element, is there a parent/ancestor element with an id or test-id which can be used to scope? Are there siblings which can be used to scope, etc. Updating your question with a larger block of HTML would be a good start – Thomas Walpole Apr 15 '22 at 15:54

1 Answers1

0

To identify the symbol on the page you can use either of the following locator strategies:

find(:css, ".ui-grid-selection-row-header-buttons[bg-click^='selectButtonClick']")

or

find(:css, ".ui-grid-selection-row-header-buttons[bg-model$='isSelected']")
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352