TypeError:在xpath中使用contains()时,定位器无效

时间:2018-06-21 05:35:19

标签: javascript selenium selenium-webdriver xpath webdriver

我的代码中存在无效的定位器问题。我已经检查过api,看起来它正确无误,有人可以查看我的代码吗?。

apply(m, 1, c)
#      [,1] [,2]
# [1,]    1    2
# [2,]    3    4
# [3,]    5    6
# [4,]    7    8
# [5,]    9   10
# [6,]   11   12
# [7,]   13   14
# [8,]   15   16
# [9,]   17   18
#[10,]   19   20

1 个答案:

答案 0 :(得分:0)

xpath 似乎有点不正确。您可以尝试以下任一 xpaths

var header = "//h1[@class='flexgrid-col'][text()='Live Dev']";

var header = "//h1[@class='flexgrid-col'][contains(.,'Live Dev')]";

var header = "//h1[@class='flexgrid-col'][normalize-space()='Live Dev']";