I attempted the code below, but unfortunately, it did not work for me.
puts @driver.execute_script("window.dataLayer[0]")
puts @driver.execute_script("console.log(window.dataLayer[0])")
Manually entering "dataLayer" in the Chrome console displays the objects as shown in the image below. I am looking to extract or print this data using Selenium.