Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98511

How to get text of role=alert with Selenium

$
0
0

I want get text of role=alert from HTML page, I can find the element but I'm not able to get the text.

<div class="alert alert-danger no-margin" role="alert"> customer.dashboard.InvalidCode

To find the element I used:

driver.FindElement(By.XPath("//div[contains(@class, 'alert')]"));

but if I try to get "customer.dashboard.InvalidCode" every time I get empty string.


Viewing all articles
Browse latest Browse all 98511

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>