0
votes

Can anyone please help me here ? I want to run two xpath together and store the value, I am not sure if it is possible. My one xpath is fetching City and second is state

//div[(text()='city')]/following-sibling::div

//div[contains(text(),'state')]/following-sibling::div 

As xpath is telling name of city and state is provided in next div of city and state. I want to run both and capture output in string format. On side note: both xpath is working fine for me.

<div>
<div>City</div>
<div>London</div>
</div>
<--In between some other elements like p, section other divs-->
<div>
<div>state</div>
<div>England</div>
</div>
Can you edit your question and show your exact expected output given your sample html and what version of xpath is available to you? - Jack Fleeting
Do you want to combine both XPath’s into one and have to strings as return? - Siebe Jongebloed