How to verify that clicked on URL is being opened before redirect in Selenium Web Driver?
<p>I am using Selenium Java WebDriver to create my tests. The test I'm trying to automate is as follows:
1) Get URL from CSS Element I'm hovering on.
2) Click on that Element (it's a link). 
3) Verify that opened URL is what expected.</p>

<p>Step 3 would be easy if opened URL was actually the same as the one obtained in step 1. However, the URL in my case gets redirected until it finally opens, thus my test case fails.</p>

<p>My current implementation:
1) With this method I get the URL:</p>

<pre><code>    public String getHrefFromElement(String selector) {
    return driver.findElement(By.cssSelector(selector)).getAttribute("href");
}
</code></pre>

<p>2) I click with this method on the selector:</p>

<pre><code>    public void click(String selector) {
    driver.findElement(By.cssSelector(selector)).click();
}
</code></pre>

<p>3) After clicking I'd get current URL and write basic assertion for comparing Href from Element obtain in #1 with current URL (it would fail).</p>

<pre><code>    public String getCurrentURL() {
    return driver.getCurrentUrl();
}
</code></pre>

<p>Question:
If clicked on URL gets redirected, could I somehow verify that URL was being opened before redirect? 
How could I get URL state from the very start before the redirect before page loads?</p>