.NET + NUnit + MSBuild project with healenium usage example
2. Configuration RemoteWebDriver for Healenium
Go into healenium folder
cd healenium
Note:
browsers.json
consists of target browsers and appropriate versions. Before run healenium you have to manually pull selenoid browser docker images with version specified in browsers.json
Example pull selenoid chrome image:
docker pull selenoid/vnc:chrome_102.0
Full list of browser images you can find here
Run healenium with Selenoid:
docker-compose up -d
docker-compose -f docker-compose-selenium-grid.yaml up -d
ATTENTION
Verify the next images are Up and Running
postgres-db
(PostgreSQL database to store etalon selector / healing / report)hlm-proxy
(Proxy client request to Selenium server)hlm-backend
(CRUD service)selector imitator
(Convert healed locator to convenient format)selenoid
/selenium-grid
(Selenium server)
To run using Healenium create RemoteWebDriver with URL http://<remote webdriver host>:8085
:
var optionsChrome = new ChromeOptions();
optionsChrome.AddArguments("--no-sandbox");
_driver = new RemoteWebDriver(new Uri("http://localhost:8085"), optionsChrome);
To temporarily disable the healing mechanism for certain sections of your code, use the following syntax:
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor) Driver;
jsExecutor.ExecuteScript("disable_healing_true");
... // Your code that does not require healing
jsExecutor.ExecuteScript("disable_healing_false");
You can run tests via Test Explorer
To run tests for specified test project in terminal with nunit3-console you need to go to /bin/Debug/
project folder
If you want to execute tests from Healenium.Selenium.Tests project, please use the command:
nunit3-console Healenium.Selenium.Tests.dll --where "class=~MarkupTests"
In case you want to run all tests in project use this command:
nunit3-console Healenium.Selenium.Tests.dll
If you want to get a Report Portal report you could use this command:
nunit3-console Healenium.SeleniumRP.Tests.dll --where "class=~MarkupTests"
Do not forget to specify your rp.uuid and rp.project values in
ReportPortal.config.json
fileHow to configure Report Portal with NUnit you can read here: https://github.com/reportportal/agent-net-nunit
You can monitor tests running if you using Healenium with Selenoid plus Selenoid Ui, go to :
http://localhost:8080