1

I have a Radcombobox in my application which has several check boxes in the combo box. What I wish to do is to fetch the text associated with the check box. I searched on internet and came to know that text can be fetched from name or value property in HTML code, but problem is that my HTML code does not have such properties. HTML code:

input class="rcbCheckAllItemsCheckBox" type="checkbox"
Check All

What i wish to do is to fetch value "Check All". Using code x = driver.findElement(By.xpath("/html/body/form/div[1]/div/div/div/input")).getText();, value returned is blank.

1 Answers1

0

You can get the text through JavaScript API of Rad Controls. You can check the official documentation- http://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/client-side-programming/overview Basically, you first locate the element in JS and then use the official control method, in your case get value method. You can also perform several other useful operations if you need to. You can execute JS in WebDriver with the following code:

IWebDriver driver; 
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
string title = (string)js.ExecuteScript("return document.title");
Anton Angelov
  • 1,705
  • 13
  • 16