2
<span id="olLabelCUSTOMERSALL">Text - ALL

In the GUI I see All and I can select this via

browser_ie.span(:id, "olLabelCONTACTSALL").click

I then tried to set this to a variable like

text1 = browser_ie.span(:id, "olLabelCONTACTSALL")

and I thought I would get ALL but I don't.

In the html screen shot what is Text - ALL? Is that an attribute of the Span element? How would I capture the text ALL from this

4

1 回答 1

3

当您这样做时,您将获得 watir span 元素:

text1 = browser_ie.span(:id, "olLabelCONTACTSALL")

如果您想要文本,请使用元素的text方法:

text1 = browser_ie.span(:id, "olLabelCONTACTSALL").text
于 2012-10-09T18:10:24.950 回答