I am finding issues with the selenium grid
and parallel
tests, when I execute the tests against the grid
with 1 node
all tests pass with no issues.
When I add a 2nd node the tests fail, I assume they are falling over one another but I'm not sure what I need to do to prevent this from happening
In my assembly, I have declared
[assembly: Parallelizable(ParallelScope.Fixtures)]
The error
on one of the tests is as follows
OpenQA.Selenium.NoSuchElementException : Unable to find element
----> System.InvalidOperationException : Session
[bda80023962a2441e3c7ae66a75e982e] was terminated due to
CLIENT_STOPPED_SESSION
Any help will be hugely appreciated
Adding to this to get some help as i am making no progress
I am using the following packages
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="NUnit" version="3.8.1" targetFramework="net452" />
<package id="NUnit.Console" version="3.0.0" targetFramework="net452" />
<package id="Selenium.Support" version="3.7.0" targetFramework="net452" />
<package id="Selenium.WebDriver" version="3.7.0" targetFramework="net452" />
<package id="SpecFlow" version="2.2.1" targetFramework="net452" />
<package id="SpecFlow.NUnit" version="2.2.1" targetFramework="net452" />
i have a standard selenium grid setup, with 2 physically separate nodes and when the tests run individually they pass with no issues but when running in parallel both tests fail with different errors
OpenQA.Selenium.WebDriverException : no such session
and
OpenQA.Selenium.NoSuchElementException : no such element: Unable to locate element
I am still completely baffled why this is happening.
Adding even more to this I am pretty sure it is due to my lack of coding skill, I think the drivers are getting confused with one another when the tests are running which is why individually they run with no issue.
so I need to try and explain what I have built to see if anyone can help
so I have a Specflow feature file This is linked to a steps class which holds the steps for the tests and nothing else
and I have a General class which I wanted each test to run through so this is responsible for creating the driver and passing it through so I fear this is where I have gone wrong.
at the top of the general class, i create the driver
public static IWebDriver Driver;
Also in the general class, I have a constructor
public General(IWebDriver driver)
{
Driver = driver;
}
in the general class i have
[BeforeScenario()]
public static void BeforeScenario()
{
Driver = StartLocalDriver();
}
[AfterScenario()]
public static void AfterScenario()
{
Driver.Quit();
}
This I was hoping would create a driver for the test before each scenario
I was hoping this would allow the driver to be assigned individually to each test but i guess the drivers can all still see one another and are getting in each others way.
i was wondering if anyone has a better approach to prevent this from happening
The steps class picks up the driver as I have a using statement at the top of each steps page
using static MoneyUITests.Methods.General;
i fear this might be difficult as the steps are in different files and some are reused for other tests
anyone able to help me with this?