cheezy / page-object

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

Any plans to support the meta tag? #425

Closed JESii closed 7 years ago

JESii commented 7 years ago

I'd like to find and work with meta tags from POM: e.g., <meta itemprop="ratingValue" content="3.6667"> Is that possible and if so, how? Thanks!

jkotests commented 7 years ago

The meta has basic element support - ie it can be accessed like other tags, but there are no special methods/behaviours for it.

For example, you can define an accessor for it:

class TestPage
  include PageObject

  meta(:rating_value, css: 'meta[itemprop="ratingValue"]')
end

page.rating_value_element.attribute_value('content')
#=> "3.6667"

You can also access it as a nested element:

page.meta_element(css: 'meta[itemprop="ratingValue"]').attribute_value('content')
#=> "3.6667"

Note that if you want to locate the meta tag with the "itemprop" attribute, you will need to use a :css or :xpath locator. "itemprop" does not appear to be supported as a valid attribute in Watir.

JESii commented 7 years ago

OK; I'll give that a whirl; I've already tried the xpath route and that didn;t work.

Thanks!