finding a dynamic element using telerik framework

489 Views Asked by At

I am very new to the telerik framework i have a que with finding dynamic elements.For example lets consider a where the content keeps changing.In selenium i will find the elements using the following code

IWebElement location = Browser.FindElement(By.Id("dynamic-ul")).FindElement(By.TagName("ul"));
ReadOnlyCollection<IWebElement> Totalli = location.FindElements(By.TagName("li"));
Totalli.FirstOrDefault(x => x.FindElement(By.ClassName("selectable")).Text == Test).Click;

what i want to know is it possible to do the same in telerik test studio. After taking the root element i am not able to select the child element for example

var location = myManager.ActiveBrowser.Find.ById("dynamic-ul").Find.ByTagName("ul");

Thanks in advance

2

There are 2 best solutions below

1
On

If only some numbers are chaging in you element ID ex: mybutton_12, mybutton_24 you can use properties like Element name Starts with ends with or using a reguler exresssion

use this link handle Dynamic IDS

0
On

You can try using Find.ByExpression as shown below:

var location = Manager.ActiveBrowser.Find.ByExpression("tagname=ul,id=dynamic-ul");