我正在尝试让 Watir 模拟移动环境,并且我按照非常有帮助的http://watirwebdriver.com/mobile-devices/中的指示逐字执行。这是我的代码。
#!/usr/bin/ruby
require 'rubygems'
require 'watir-webdriver'
require "webdriver-user-agent"
require 'headless'
$headmode = 0
$screens = 0
headless = Headless.new if $headmode == 1
headless.start if $headmode == 1
driver = UserAgent.driver(:browser => :firefox, :agent => :iphone, :orientation => :landscape)
....... snip ......
....... snip ......
抛出的异常是......
/var/lib/gems/1.8/gems/webdriver-user-agent-0.0.5/lib/webdriver-user-agent.rb:39:in `agent_string_for': undefined method `downcase' for :iphone:Symbol (NoMethodError)
from /var/lib/gems/1.8/gems/webdriver-user-agent-0.0.5/lib/webdriver-user-agent.rb:11:in `driver'
from ./test_CAPI.rb:11
不是 Ruby 开发人员,也不是精通 WATIR(还),我对这个错误感到困惑。任何人都可以对此有所了解吗?非常感谢珍妮