Laravel Dusk: getAttribute('innerHTML') stopped working ?
Hi there,
I have some Laravel Dusk code here that was working perfectly well a couple days ago, and doesn't work anymore, even though i didn't modify it. So this is the code:
$nbTools = $browser->elements('.navigation--horizontal__link')[0]
->getAttribute('innerHTML');
So, dd($nbTools); used to return the data i was interested in, but now it just returns null.
Note that i get exactly the same 'null' if i look for the element using its xpath, with this code instead:
$nbTools = $browser->driver
->findElement(WebDriverBy::xpath('//*[@id="content"]/div/div[1]/div/div[2]/div/div[2]/nav/ul/li[1]/a'))
->getAttribute('innerHTML');
The data i'm interested in is displayed as expected (i see it it the browser running) but my code won't return it.
The html is:
<a href="/toolbox/jonsimard" data-et-name="toolbox" data-et-element-type="button" class="router-link-exact-active navigation--horizontal__link--selected navigation--horizontal__link">
3
<p class="caption navigation__link__subtext">
Tools
</p>
</a>
Until a couple days ago, $nbTools was returning:
3<p class="caption navigation__link__subtext">Tools</p>
I'm only interested in the number '3', but it was easy to extract from the string above.
The only thing that might have changed (i don't think it did but it might have) is the $browser object. Other than that, i didn't change anything in this part of the code, and everything before this snippet works as expected and like it did before.
What might be going on here? What did i miss?
Please help! :)
Please or to participate in this conversation.