2

我正在尝试将文本插入文本字段。它有一些特殊字符。原来是 Chrome 和 IE 的问题。

browser = Watir::Browser.new :chrome #or :ie
# here are some steps
field = browser.text_field
field.set "O'Reily" #this is just an example of problematic text
# after this field.value equals "O''Reily" when using chrome

Chrome 在我的引号前插入单引号。这不是唯一的情况。当我用这个原始文本设置字段时:

~ !^ & ` ´ ¨ ' "

Chrome 实际上用这个值设置字段

`~!^ & ``'''¨ '''"

在 IE 中它会删除一些空格

~!^& `´¨ ' "

只有 Firefox 使用我的原始文本设置字段。

有人可以帮我在 Chrome 和 IE 中设置确切的文本吗?谢谢。

4

1 回答 1

0

您是否在文件顶部尝试过此操作?来自Watir-General

# coding: UTF-8
于 2012-10-02T22:55:22.930 回答