How do I get this div tag using selenium webdriver?

Posted by user1603518 on Stack Overflow See other posts from Stack Overflow or by user1603518
Published on 2012-08-21T14:21:20Z Indexed on 2012/09/02 15:38 UTC
Read the original article Hit count: 239

Filed under:
|
|
<div id="ctl00_ContentHolder_vs_ValidationSummary" class="errorblock">
    <p><strong>The following errors were found:</strong></p>
    <ul><input type="hidden" Name="SummaryErrorCmsIds" Value="E024|E012|E014" />
        <li>Please select a title.</li>
        <li>Please key in your first name.</li>
        <li>Please key in your last name.</li>
    </ul>
</div>

I want to capture the text having value of E024 E012 and E014 and write it in to an Excel file.

I tried the following but it doesn't work.

string val1 = driver.FindElement(By.XPath("//div[contains(@class, 'errorblock'/ value = 'E024|E012|E014'")).Text;

How can I do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about selenium