I have an DOMXPath object, that I created from a DOMDocument, that is this amazon website:
I am trying to use some XPaths that work on my Google Chrome, but when I try them on the DOMXPath they doesn't seem to be working.
Here is the example:
$dom = new \DOMDocument();
$dom->loadHTML($html);//HTML is amazon url
$html_document= new \DOMXPath($dom);
$html_document->query('//*[@id="dp"]//*[@id="productTitle"]/text()');
If you check that XPath on Google Chrome inspector, you will see that it works and it gives you the product title. If I only put "//*[@id="productTitle"]/text()" it works, but the thing is I need to know why the other way does not work as sometimes I need that kind of XPath.
Thank you