Very new to Selenium testing and after reading the doc I tried to setup my own Selenium Grid Hub but I'm failing to use it for my local testing.
I setup the Selenium Grid Hub on a kubernetes cluster (following https://github.com/kubernetes/examples/tree/master/staging/selenium) and I manage to reach my nodes.
I've built a simple java application to test this is working as expected and I manage to reach web based url like http://www.google.com but I would like to be able to test my local app by using my RemoteWebDriver
.
Here is what is actually working:
log.info("test selenium");
ChromeOptions chromeOptions = new ChromeOptions();
WebDriver driver = new RemoteWebDriver(new URL("http://my-k8-node.com:32223/wd/hub"), chromeOptions);
driver.get("http://www.google.com");
String pageSource = driver.getPageSource();
log.info(pageSource);
driver.quit();
But I get a This site can't be reached - localhost refused to connect.
with
driver.get("http://localhost:8080/health/check");
The same with
driver.get("http://host.docker.internal:8080/health/check");
Or with
driver.get("http://127.0.0.1:8080/health/check");
I didn't find any documentation on how to achieve this kind of setup but any hint is welcome.
I would like to further integrate the selenium testing to my Gitlab CI/CD so I should be able to run the test from a "local" point of view.
Thanks for reading.