如何参数在真正的客户端脚本的XPath

问题描述 投票:0回答:1

这是我的情景 - 我在应用程序的网格。网格包含复选框过滤器。当选择复选框过滤器将在应用程序被应用。我已经写了XPath来选择一个复选框(例如:// DIV [文本()=“FirstFilter”] / DIV)这将选择FirstFilter复选框。

我想参数化的XPath这样,如果任何过滤器名,则该过滤器复选框应选择。我无法找到的选项paarmae​​terize在trueclient中的XPath。

任何建议请。

xpath loadrunner
1个回答
0
投票

你可以把一个String FILTERNAME,然后使用,可以参数化中的XPath,如:

String filterName = null;       
// Insert the value in the filterName according to your requirements
WebElement element = driver.findElement(By.xpath("//div[text()="+filterName+"']/div"));
© www.soinside.com 2019 - 2024. All rights reserved.