I'm trying to get the text value of checkbox label. Here is an HTML code
<div id="content" class="large-12 columns">
<div class="example">
<h3>Checkboxes</h3>
<form id='checkboxes'>
<input type="checkbox"> checkbox 1</br>
<input type="checkbox" checked> checkbox 2
</form>
</div>
So What I have tried so far
Driver.FindElement(By.XPath("//input[@type='checkbox']")).Text;Driver.FindElement(By.XPath("//input[@type='checkbox']")).GetAttribute("value");Driver.FindElement(By.XPath("//input[@type='checkbox']")).GetAttribute("name");Driver.FindElement(By.XPath("//input[@type='checkbox']")).GetAttribute("innerText");Driver.FindElement(By.XPath("//input[@type='checkbox']")).GetAttribute("innerHTML");
All this attempts return "".
Any ideas how to get it or Javascript is my only option ?
findelementshould return first element from all elements. And see them but propertyTexthas value ` "" ` .