"Incompatibility between Ruby + watir-webdriver and Selenium Grid2 causes an exception

Using selenium-server-standalone-2.18.0.jar. Configured the hub and node on the same host. Executing the client code on a separate host.

Observing in the hub console, I notice that one of the nodes has connected with 5 firefox icons. Upon running my client code, I witness that one of the firefox icons disappears, indicating that the hub has assigned the task to the connected node. There are no errors present in the hub logs. Launching the browser using ruby + watir-webdriver:

capabilities = WebDriver::Remote::Capabilities.firefox
b=Watir::Browser.new(:remote, :url => "http://[remote-host]:4444/wd/hub", :desired_capabilities => capabilities)

The encountered error is as follows:

from (irb):52>> b=Watir::Browser.new(:remote, :url => "http://[remote-host]:4444/wd/hub", :desired_capabilities => capabilities)
Selenium::WebDriver::Error::UnknownError: Error forwarding the new session request for webdriver should contain a location header with the session. (org.openqa.grid.common.exception.GridException)
... 

Answer №1

Version 2.21.0 of Selenium Grid addressed numerous bugs and improvements. It is recommended to execute your tests using the latest JAR file.

Answer №2

Hello! I see that it's been quite some time since you first posted your question. Have you managed to find a solution for it yet? If not, here's a suggestion regarding the variable for capabilities that may help:

In my experience using Cucumber with Watir-webdriver and Selenium Grid2, I found success by utilizing an env.rb variable named browser_name. Here's how it was implemented:

def browser_name
  (ENV['BROWSER'] ||= 'firefox').downcase.to_sym
end

Subsequently, within the env.rb file:

Before do
    @browser = Watir::Browser.new(:remote, :url=>"http://[mygridhubhost]:4444/wd/hub", :desired_capabilities=> browser_name)

By initiating the test in this manner, it establishes a connection with the grid based on the specified browser_name value (defaulting to firefox if not explicitly set) before execution...

This configuration has proven effective for me, particularly when operating with Selenium Grid 2 version 2.31.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Chrome WebDriver sample encounters issues when executed on Redhat 8

Issue Description: When running tests using JMeter on a Red Hat server, the results show as zero. https://i.stack.imgur.com/756iK.png The system is RHEL 8 and is running in headless mode. The tests run without any problems on Windows. I have verified mu ...

Error: The object of type 'WebElement' cannot be accessed with square brackets

I am attempting to use Python to click the Replay button on Spotify's Web Player, but I keep encountering an error. How can I go about clicking buttons in a web player? replay = driver.find_element_by_xpath("""/html/body/div[2]/div/div[ ...

BeautifulSoup does not recognize circular HTML pages

Encountered an issue where the page parsing code consistently checks the same page every time, despite using it alongside selenium. Selenium has no problem opening new links, but the parsing only occurs on the initial page. The frustrating part is that si ...

Tips for troubleshooting a testcase in testng when utilizing a framework that includes page factory

Having trouble debugging a web app test case created using Selenium, testing, and Eclipse. The page object classes are all set up with elements and service methods. These page object classes are being utilized in the test classes. However, one particular t ...

Switching ChromeDriver in Java Selenium based on the version of ChromeLet me

Encountering the following error when there is a mismatch between chromedriver and chrome version: org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot find context with specified id"} (Sessio ...

Selenium Web-Driver Pop-up

I'm encountering an issue with a popup message when trying to write using Selenium. Would appreciate any assistance or insight. Here is my code:- public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "F:\\ge ...

Is it possible to execute Selenium on a web server?

Looking for assistance with setting up an ASP.Net Core web API that executes Selenium automation once it receives requests. While I managed to make it work in headless mode on my local machine, the deployment to an IIS web server caused a breakdown, resu ...

What steps are needed to transfer a Jenkins job from a Windows computer to a Linux server?

After successfully setting up Jenkins on my Windows local machine, I created a new job which is working perfectly. Now that I have installed Jenkins on a dedicated Linux server, I am wondering how to migrate this job from my local Windows machine to the ...

Selenium encountering issues with loading additional content on Meetup tech page

I have been troubleshooting this issue for the past few days with no luck :( Is there anyone who can offer assistance? The problem I'm facing is that when selenium clicks "show more" on a specific city in the meetup website, it loads but nothing displ ...

Having trouble extracting three specific fields from a table due to its complex design

I have developed a Python script using Selenium to extract three fields - franking credit, gross dividend, and further information from a table on a website. The additional fields are only displayed when a circular yellow button with a plus sign is clicked ...

Unable to set a value for the variable

const readline = require('readline'); let favoriteFood; const rl = readline.createInterface(process.stdin, process.stdout); rl.question('What is your favorite food?', function(answer) { console.log('Oh, so your favorite food is &a ...

Tips for creating selenium code to interact with an autocomplete text box and select an item from the list

Can someone assist with writing Selenium code for the following HTML source code? This field is auto-populated for input selection. <input id="ctl00_ContentPlaceHolder1_txtBranch" class="textbox_service ui-autocomplete-input" name="ctl00$ContentPlaceH ...

Setting up the IEDriverServer.exe using command line in Protractor is a simple and efficient process

Is there a way to specify the path to the IEDriver executable using the command line with Protractor? I've tried the following command, but it doesn't seem to recognize the path to the IEDriver executable. cd > protractor --seleniumArgs "[&ap ...

Waiting for element to be clickable or visible in Selenium using C#

I am looking to enhance my current method to handle two specific tasks: Waiting for an element to become visible - (currently using ExpectedCondition, but it may need to be updated) Waiting for an element to become clickable - (Encountering issues with " ...

Switch out the <br/> tag for a comma when coding in HTML

Check out the HTML code below: <a target="_blank" href="http://keyes.findbuyers.com/search_details/hGdxEaI0bAO568MBDtCCfvjtY74dYmJKhIeURpGbbtxBQvzbNLwrKJL381lFafq10-YkJ58zGW6Lc8fpOny7fW/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data ...

An uncaught exception occurred with the WebDriverBackedSelenium wait timeout

When using WaitForPageToLoad(timeout) with webdriverbackedselenium, an unhandled exception is being thrown even though there is a try catch block in place. try { selenium.WaitForPageToLoad(timeout); } ...

Executing Firefox Marionette Commands Independently from Selenium and Geckodriver

I am interested in utilizing Firefox's marionette interface directly over TCP without relying on geckodriver or selenium packages. Unfortunately, I have been unable to locate a comprehensive list of marionette commands. The only available documentatio ...

Executing TestNG tests without the need of an XML file utilizing TestNG code

I have a set of tests ready, but I am facing an issue with running them. Currently, I am working in normal Java environment and to run multiple tests, I am using TestNG. However, I am unsure about how to write the code to run multiple tests using TestNG an ...

Getting the text value from a strong tag is a simple task that can be

I am having difficulty retrieving the text value that is located within the strong tag, as it changes after a specific task or execution in the browser. Here is the HTML code before the execution of the task: <div> <strong>heizil</stron ...

Removing file extensions using Selenium in Python

After utilizing a code snippet for proxy from this source, I encountered difficulties in disabling or removing the proxy extension. Despite my efforts to locate it in the extensions folder within the profile directory, no extensions were found installed vi ...