Getting the URL of the current page using Selenium WebDriver
Put sleep. It will work. I have tried.The reason is that the page wasn't loaded yet.Check this question to know how to wait for load - Wait for page load in Selenium
Put sleep. It will work. I have tried.The reason is that the page wasn't loaded yet.Check this question to know how to wait for load - Wait for page load in Selenium