Tcl - Selenium WebDriver:通过包含文本查找div元素?

时间:2016-06-21 14:12:04

标签: selenium selenium-webdriver tcl selenium-chromedriver

是否有任何tcl等价物:

driver.find_elements_by_xpath("//*[contains(text(), 'Lookup Network Elements')]")?

我正在尝试运行类似:

set networkButton [$window element by_xpath "//*\[@class=\"frost-button\"\]//div\[contains(\"Network\")\]"]

但它给了我错误

::invalidSelectorError10

1 个答案:

答案 0 :(得分:4)

你的contains()是错误的,它不是在寻找text()元素。你需要写一些类似的东西:

set networkButton [$window element by_xpath "//*\[@class=\"frost-button\"\]//div\[contains(text(), \"Network\")\]"]

set networkButton [$window element by_xpath "//*\[@class=\"frost-button\"\]//div\[text()\[contains(., \"Network\")\]\]"]
相关问题