简体   繁体   English

使用telerik框架查找动态元素

[英]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 我对telerik框架非常陌生,可以查询动态元素,例如考虑内容不断变化的地方。在硒中,我将使用以下代码查找元素

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. 我想知道的是,有可能在telerik测试工作室中做同样的事情。 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 如果只有一些数字在您的元素ID中:mybutton_12,mybutton_24,则可以使用元素名称之类的属性,以“ ...”开头或以“ reguler”开头

use this link handle Dynamic IDS 使用此链接处理动态IDS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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