I understand that you can get the text from an element, like this:
$text = $browser->text('.selector');
My question is: How can you get the raw HTML content? E.g. the following doesn't work
$text = $browser->html('.selector');
E.g. if the element is:
<div class='selector'><p>Hello</p></div>
I'd like to get the following as the output (with the < p> tags):
<p>Hello</p>
Thanks
To get the source code of your element you should use the element()
method together with the getAttribute()
like this:
$html = $browser->element('.selector')->getAttribute('innerHTML');
// now in $html you have HTML inside .selector element