简体   繁体   中英

finding a dynamic element using telerik framework

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

您可以尝试使用Find.ByExpression,如下所示:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM