How to check page url in selenide ?
For example I should check if url() is www.google.pl
Thanks
Selenide support checking urls from version 5.23.0. Enjoy
import static com.codeborne.selenide.WebDriverConditions.*;
webdriver().shouldHave(url("https://auth.google.com"));
webdriver().shouldHave(url("https://mastercard.ee"), Duration.ofSeconds(42));
webdriver().shouldNotHave(url("http://yandex.ru");
webdriver().shouldNotHave(urlStartingWith("ftp://"));
webdriver().shouldHave(currentFrameUrl(baseUrl + "/login.html"));
webdriver().shouldHave(currentFrameUrlStartingWith(baseUrl + "/logout.html"));```
You need to get
browser address url
. This is how to getcurrent url
bySelenide
:Solution example with
junit4
assertEquals()
method:with
junit4
&Selenide
imports:Tested. Results: