How to change URL in Selenium without opening new tab (python)?

Viewed 2894

I saw some .navigate() functions to do that in java but it's not in python.

So, how can I just change the URL of currently opened window without opening a new tab?

1 Answers

Just call driver.get('yourURL') again. Example:

driver = webdriver.Chrome()
driver.get('https://google.com')
print(driver.current_url)
driver.get('https://gmail.com/')
print(driver.current_url)

Output:

https://www.google.com/
https://www.google.com/intl/id/gmail/about/#
Related