I have a Selenium Test and in the test I am clicking on a submit button inside a form like following:
WebElement form = someContainerElement.findElement(By.cssSelector("form"));
form.submit():
Next I am refreshing the page manually by calling the same url again like following:
String url = customFunctionToBuildUrlFromPath("some/custom/page");
webDriver.get(url);
By the way, the webDriver is of type RemoteWebDriver.
Next I am just testing a few webelements for example if they do exist or not.
Everything works fine locally. On gitlab Pipleine it doesn't. On the pipeline it only works if i add Thread.sleep(3000) it also works on the pipeline.
So I guess I have to wait until the server has processed the post request. Locally it is fast enough but the gitlab Runner is not fast enought.
➡️ So I need to wait until the server sends the answer of the post request or the page is at least refreshed. How do you wait in Selenium for the answer of a form submit?
I tried to use WebDriverWait it doesn't seem like there is something like WebDriverWait.until(PageRefresh)