<p class="details-info-block__text"><span class="details-info-block__label">Business Address 1:</span> 1010 Priority Way West Dr</p>

I want to verify the address value (e.g. "1010 Priority Way West Dr"). But retrieving it using XPath //span[contains(text(), 'Business Address 1')]/.. returns the following string

Business Address 1: 1010 Priority Way West Dr


2 Answers 2


You can retrieve all inner text of <p class="details-info-block__text"> and then parse out the required text using String-related toolset of C#. It will be quite a tricky thing to extract what you want using selenium since the latter piece of text is a separate "naked" text node in a DOM and Selenium cannot parse it to a dedicated WebElement (anything having no associated tag)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.