Question

All of my automation is in watir-webdriver. I used to configure my browser as Firefox, like so:

@profile = Selenium::WebDriver::Firefox::Profile.new
@profile.native_events = false
@client = Selenium::WebDriver::Remote::Http::Default.new
@client.timeout = 300
@b = Watir::Browser.new :firefox, :profile=>@profile, :http_client=>@client
@b.driver.manage.timeouts.implicit_wait = 30

When I switched to this:

@server = Selenium::Server.new("./selenium-server-standalone-2.20.0.jar", :background=>true)
@server.start
@caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled=>true)
@client = Selenium::WebDriver::Remote::Http::Default.new
@client.timeout = 300
@b = Watir::Browser.new(:remote, :url=>"http://127.0.0.1:4444/wd/hub", :desired_capabilities=>@caps, :http_client=>@client)
@b.driver.manage.timeouts.implicit_wait = 30

I start failing on the first, very simple task

@b.link(:text, "Login Again").click

Watir::Exception::UnknownObjectException: unable to locate element, using {:text=>"Login Again", :tag_name=>"a"}

How can I go about figuring out why this is and what I can do about it? I don't know where to start with this.

Was it helpful?

Solution

I'd have a look at the Headless gem. See this blog entry from Alister's Watirmelon blog

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top