这是我的情景 - 我在应用程序的网格。网格包含复选框过滤器。当选择复选框过滤器将在应用程序被应用。我已经写了XPath来选择一个复选框(例如:// DIV [文本()=“FirstFilter”] / DIV)这将选择FirstFilter复选框。
我想参数化的XPath这样,如果任何过滤器名,则该过滤器复选框应选择。我无法找到的选项paarmaeterize在trueclient中的XPath。
任何建议请。
你可以把一个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"));