1

The Test solution has 2 projects - one Test project with the the test methods (it inherits from a base class which has the test steps written in detail) and the other Project is a Class library project which contains the commonly used methods and the actual steps of the tests.

Using this solution to test data entry pages.

Problem

When I execute the tests in parallel using Selenium Grid, all the tests fail - it opens up the Chrome browser and then nothing.

The test report says that it the server timed out.

When I run the tests sequentially they all pass (without Selenium Grid).

What I have done till now:

  1. using Selenium Grid 2

1.1. to start the hub open command window (with admin access) and run the following command in the selenium directory:

    java -jar selenium-server-standalone-2.5.0.jar -role hub

1.2. open another instance of command window (with admin access) and run the following command in selenium directory:

    java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.chrome.driver=\chromedriver.exe -role wd -hub http://4444/grid/register> 

2.execute the tests in powershell running the following:

    PS>run-gallio test.dll

3.to use the chrome driver

    DesiredCapabilities capability = DesiredCapabilities.Chrome();
    capability.SetCapability(CapabilityType.BrowserName, "chrome");
    driver = new RemoteWebDriver(capability);

4.In the main test Project in assemblyinfo.cs - have added the following attributes:

    [assembly: DegreeOfParallelism(4)]
    [assembly: Parallelizable(TestScope.All)]

5.For each class have attribute of Parallelizable and each test method also has the attribute of Parallelizable.

Some of what I have tried

  1. set the browser binary location using DesiredCapabilities

    DesiredCapabilities - capabilities.SetCapability("chrome.binary",this.binaryLocation); 
    

(Remote Webdriver Chrome throws a "path to the driver executable" error) This did not work for me.

  1. set the chrome driver in the when invoking hub command How to build remote Webdriver for Chrome (This opens up the chrome browser but nothing after that)

  2. Also looked at this: How to run multiple browsers on one hub using Selenium Grid2

  3. Tried multithreading also but that did not work (used ChromeDriver instead of RemoteWebDriver).

Error I get now

Run-Gallio : [failed] Test/AddValue  Set Up
OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server -
--> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 4444
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6,Socket& socket, IPAddress address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)    

What could the problem could be?

What could I try within Selenium Grid? All guidance would be appreciated.

cannot switch from selenium or C# to anything else. Thank you.

Edit: A few days later, using Selenium-server-2.41.0 and now getting the following timeout error message.

    OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4444/wd/hub/session/fdb51889-b9b7-4e97-beea-44dcf9637b0c/element/0/value timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out  

Added timeout span when calling the remotedriver for chrome DesiredCapabilities capability = DesiredCapabilities.Chrome(); driver = new RemoteWebDriver(capability); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(120));

this did not work. Any suggestions?

Edit Answer: Managed to solve the issue - There were errors on the page and due to network issues on my side - the pages were not fully loading and the script would search for the elements. Fixed this - Thank you Daniel and Faiz.

Community
  • 1
  • 1
nitapillai
  • 21
  • 6
  • Check your firewall. This line is telling you the problem: `System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 4444` – Daniel Mann May 07 '14 at 17:25
  • 2
    In your command at `1.2`, you are using `http://4444`....typo? – Arran May 07 '14 at 18:02
  • Definitely need to address the issues in previous comments first. Also use the latest [selenium-server-standalone-2.41.0.jar](http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar), the 2.5.0 version is ancient. – Faiz May 08 '14 at 02:12
  • Thank you Daniel Mann, will look at that And Arran - In the 1.2 command it should be local host but could not write that out in this post and Faiz - Thank you for that - will use the selenium server 2.41.0. Thanks again. – nitapillai May 08 '14 at 02:16
  • Faiz - downloaded the selenium server version you listed out and it seems to work. still checking though. Thanks. – nitapillai May 08 '14 at 09:44
  • Finally got it work. Downloaded the latest selenium version (2.41.0), ran the tests and they worked. Major reasons were network latency (could not find element error and session timing out) and the tests were failing because of page issues. Thank you for helping out. – nitapillai May 16 '14 at 03:14

1 Answers1

0

Should be:

[assembly: DegreeOfParallelism(2)]
[assembly:Parallelizable(TestScope.All)]

I was having some problems managing maximum sessions and maxinstances. So please mark them according as below when running the node.

java -Dwebdriver.chrome.driver="C:\ChromeDriver\chromedriver.exe" -jar selenium-server-standalone-2.42.2.jar -role node -hub http://localhost:4444/grid/register -port 5555 -browser "browserName=chrome,maxSession=1,maxInstances=1,platform=WINDOWS,ensureCleanSession=true"
Serpiton
  • 3,676
  • 3
  • 24
  • 35
krishna
  • 16