使用 CasperJS 单击具有特定格式的可变属性值的元素
Clicking on an element with a variable attribute value in a certain format with CasperJS
我有那个代码片段可以在 CasperJS 中点击一个按钮。
this.click('input[name="suggestion-to-repeat:5:suggestion:subForm:select-email"]');
问题是,名称中有一个变量 Number。在这个例子中是“5”。 Number 可以在 1-10 之间。是否有机会使用通配符或任何其他可能性 select 按钮?
看看 https://www.w3.org/TR/selectors/#selectors 以下内容可能会有所帮助:
E[foo^="bar"]一个 E 元素,其 "foo" 属性值恰好以字符串 "bar"[=20 开头=]
E[foo$="bar"]一个 E 元素,其 "foo" 属性值恰好以字符串 "bar"
结尾
尝试:
'input[Name^="suggestion-to-repeat:"][Name$=":suggestion:subForm:select-email"]'
我有那个代码片段可以在 CasperJS 中点击一个按钮。
this.click('input[name="suggestion-to-repeat:5:suggestion:subForm:select-email"]');
问题是,名称中有一个变量 Number。在这个例子中是“5”。 Number 可以在 1-10 之间。是否有机会使用通配符或任何其他可能性 select 按钮?
看看 https://www.w3.org/TR/selectors/#selectors 以下内容可能会有所帮助:
E[foo^="bar"]一个 E 元素,其 "foo" 属性值恰好以字符串 "bar"[=20 开头=] E[foo$="bar"]一个 E 元素,其 "foo" 属性值恰好以字符串 "bar"
结尾尝试:
'input[Name^="suggestion-to-repeat:"][Name$=":suggestion:subForm:select-email"]'