I am working on Watir webdriver and I want to get text of the h1 tag of the page
<body class="not-front not-logged-in page-node node-type-first-drive one-sidebar sidebar-right col-2 bp col-2 lightbox-processed" data-twttr-rendered="true">
<div class="container">
<div id="header">
<div class=""></div>
<div class="col-center">
<h1>New Page header</h1>
The code that I am writing is
@title2 = @browser.h1.attribute_value "text"
puts @title2
BUT the output that I am getting is Nil instead of "New Page header"
Have you tried
puts @browser.h1.text
or
puts @browser.div(:class => 'col-center').h1.text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With