Hi
I am using webdriver-user-agent mentioned here - 
http://watirwebdriver.com/mobile-devices/

This is the code we are using when trying out.
We are running this on Chrome/FF

     http_client = Selenium::WebDriver::Remote::Http::Default.new
     http_client.timeout = HTTP_TIMEOUT
     profile = Selenium::WebDriver::Firefox::Profile.new
     device  = ENV["DEVICE"]
     orientation = ENV["ORIENTATION"]
     driver = UserAgent.driver(:browser => :firefox, :agent =>device, 
:orientation=>orientation)
     devices = UserAgent.resolution_for(device,orientation)
     UserAgent.resize_inner_window(driver,devices[0],devices[1])
     Watir::Browser.new driver

Now when the last statement is executed, i get the following error

(STEP) Launching FIREFOX (using web driver user agent)......
browser: <printing whats is in the browser variable in loader.rb given in 
the next line>
#<Selenium::WebDriver::Driver:0x007fb6315842f8>
undefined method `*to_sym*' for 
#<Selenium::WebDriver::Driver:0x007fb6315842f8> (NoMethodError)
/Users/rambighananthan/.rvm/gems/ruby-1.9.3-p194/gems/watir-4.0.2/lib/watir/loader.rb:42:in
 
`load_driver_for'
/Users/rambighananthan/.rvm/gems/ruby-1.9.3-p194/gems/watir-4.0.2/lib/watir/loader.rb:8:in
 
`new'

Based on some investigation, problem is happening at highlighted line below 
as its trying to .to_sym on the selenium webdriver object.

def load_driver_for(browser)

        if browser && browser.to_sym != :ie && Watir.driver == :classic
          Watir.driver = :webdriver
        end
 Watir.load_driver
end

But if we add a line like highlighted below, problem is resolved

def load_driver_for(browser)

   if 
"#{ENV["BROWSER"]}".eql?("chrome_useragent")||"#{ENV["BROWSER"]}".eql?("firefox_useragent")
       Watir.driver = :webdriver
   else
    if browser && browser.to_sym != :ie && Watir.driver == :classic
          Watir.driver = :webdriver
    end
   Watir.load_driver
 end
end

since this is watir code outside of our framework, this is not the right 
way to do this, any suggestion on how to avoid this situation ?
using watir 4.0.2 / selenium-webdriver 2.30.0 

Regards
Ragavan

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to