Im trying to locate an element by xpath using the following path but am receiving the below error. Is it possible for xpath to find this element? Or is this an issue with the driver itself?
I want to be able to differentiate between the values in /p[4]/text()[1] and /p[4]/text()[2]
.//*[@id='content']/p[4]/text()[1]
org.openqa.selenium.InvalidSelectorException: The given selector .//*[@id='content']/p[4]/text()[1] is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: The result of the xpath expression ".//*[@id='content']/p[4]/text()[1]" is: [object XrayWrapper [object Text]]. It should be an element.
This is the html for an example. Im trying to verify the text '(extra questions for session)' with /text().
<div class="ad_field">
<label for="survey_id">Survey</label>
(extra questions for session)
<br>
</div>