I'am not able to get the content value of meta tag from site in Ruby using Watir-webdriver gem.
eg
<meta property="og:title" content="【楽天市場】ダヴ メンプラスケア クリーンコンフォート泡洗顔 つめかえ用(110mL)【unili3e102】【ダヴ(Dove)】[ダヴ 洗顔]:爽快ドラッグ">
The problem with browser.meta(:property, 'og:title').content
is that "property" is not a valid attribute for meta tags. As a result, Watir does not allow it as a locator method.
To locate elements via unsupported attributes, you will need to use a CSS-selector:
browser.meta(css: 'meta[property="og:title"]').content
Or use XPath:
browser.meta(xpath: '//meta[@property="og:title"]').content
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.