开发者

How can I get watir-webdriver and safariwatir working together?

Good morning,

I am setting up watirgrid and I have been partly successful, however I am having problems getting all the providers to work with my ruby script.

On my Mac I have setup a provider from the command line using:

provider -d safariwatir -c druby://192.168.0.1:11235

and then on my Ubuntu machine I setup another provider thus

provider -d webdriver -c druby://192.168.0.1:11235

Now if I use the following ruby code:

require 'rubgygems'
require 'watirgrid'

Watir::Grid.control(:controller_uri => 'druby://192.168.0.1:11235', :browser_type => 'firefox'_ do |browser, id|
    puts "Browser id is #{i}"
    browser.goto("http://www.google.co.uk")
    puts browser.title
end

This sort of works in that both browsers start up and goto the selected page. However I do not want to have to specify 'firefox' as a browser type as I want to target all browsers in the grid (IE on Windows, FF on Mac etc). So I then try to take out 'firefox' from the Grid.control command and whilst 'Safari' starts up I get an error from the second browser as it does not know what to run I am guessing.

(Apologies but I am not at my machines to recreate the error and post it here. I will upd开发者_C百科ate the post with this when I can).

I have tried to start the webdriver provider with the -b switch:

provider -d webdrive -c druby://192.168.0.1:11235 -b firefox

and then run the same ruby code again, without the browser type, but i get the same error.

Am I missing something here?

I assume that it is normal to run multiple providers on a machine that has several browser, just on different ports.

I have had some success with this, I have got Chrome working with the webdriver on an isolated machine, and I think it will really help with my web development, I just need to get past this problem so thanks for any help. I hope this all make sense.

Thanks, Russell


Interesting use case, I hadn't thought of that (on the same machine with different browsers AND different driver types)

Have a look at the latest build

gem install watirgrid --pre

There's an example in rspec here: https://github.com/90kts/watirgrid/blob/master/spec/grid_mixed_spec.rb

If you're going to start more than one provider on the same machine, make sure they're separated using the -p argument by unqiue ports. I've also fixed a bug so that if you specify -b browser_type it will default to that browser type if not explicitly defining it in Watir::Grid params.

Let me know how you go...


This might be a bit easier now that Webdriver has added support for Safari

See here for more info: http://watirmelon.com/2012/04/17/using-watir-webdriver-with-safari-at-last/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜