cheezy / page-object

Gem to implement PageObject pattern in watir-webdriver and selenium-webdriver
MIT License
653 stars 220 forks source link

Located element by tagname #462

Closed williamhub closed 6 years ago

williamhub commented 6 years ago
<div>
  <bookmark-button custom-attribute-here >
</div>

Do we have any methods to locate a non-standard element by its tag-name? For the above case, how can i locate the bookmark-button by its attribute in the html?

I came across the documentation, but still failed to figure it out how to get this element.

Thanks a lot

stevegibson commented 6 years ago

button(:my_button, bookmark_button: 'custom-attribute-here') should do the trick. See page 122 'Located based on presence of attribute' on the Cucumbers and Cheese book. Cheers.

jkotests commented 6 years ago

You'll need to use the general #element accessor with the :tag_name specified:

element(:bookmark, tag_name: 'bookmark-button', custom_attribute_here: 'attribute_value')
williamhub commented 6 years ago

Thanks @jkotests @stevegibson