Failure/Error: expect(page).to have_selector("li:nth-child(1) > dl:nth-child(6) > dd")
expected to find css "li:nth-child(1) > dl:nth-child(6) > dd" but there were no matches
Above is my error. I'm struggling to find a way to verify the date and time logged in when a user signs in. I have tried to validate that the selector/xpath/css exist, but it doesn't seem to find a match. Below is some ways I tried to proceed to verify, but it's not happy. Any ideas?
expect(page).to have_selector("li:nth-child(1) > dl:nth-child(6) > dd")
expect(page).to have_xpath("/html/body/main/ul[@class='visitors']/li[1]/dl[6]/dd")
Here is part of the page source from the web application I'm trying to validate.
<ul class='visitors'>
<li>
<dl>
<dt>Title</dt>
<dd></dd>
</dl>
<dl>
<dt>First name</dt>
<dd>John</dd>
</dl>
<dl>
<dt>Last name</dt>
<dd>Doe</dd>
</dl>
<dl>
<dt>Email</dt>
<dd>johndoe@gmail.com</dd>
</dl>
<dl>
<dt>Signed in at</dt>
<dd>April 26, 2021 08:25</dd>
</dl>
</li>
` tag of date field. i.e. `
– Sampat Badhe Apr 29 '21 at 03:08` use the class in xpath while verifying the content. Is it possible for you to add class?