I am having the following xPath that gets image from <div class="separator">
. My question is how can I make the xPath to search in <div class="entry">
also?
$img = $xpath->query('//div[@class="separator"]//img');
Thanks in advance :)
if you are looking OR (|) operator in xpath, you can try like this "(.//span[@class='g-title'])[2]|.//span[@class='g-title']" .
XPath expressions can use comparison operators. Comparison operators compare one value to another. The resulting value is a "boolean" value.
XPath text() function is a built-in function of the Selenium web driver that locates items based on their text. It aids in the identification of certain text elements as well as the location of those components within a set of text nodes. The elements that need to be found should be in string format.
XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.
$img = $xpath->query('//div[@class="separator" or @class="entry"]//img');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With