[英]How to change URL in Selenium without opening new tab (python)?
I saw some .navigate()
functions to do that in java but it's not in python.我在 java 中看到一些
.navigate()
函数可以做到这一点,但它不在 python 中。
So, how can I just change the URL of currently opened window without opening a new tab?那么,如何在不打开新标签的情况下,只更改当前打开的 window 的 URL 呢?
Just call driver.get('yourURL')
again.只需再次调用
driver.get('yourURL')
。 Example:例子:
driver = webdriver.Chrome()
driver.get('https://google.com')
print(driver.current_url)
driver.get('https://gmail.com/')
print(driver.current_url)
Output: Output:
https://www.google.com/
https://www.google.com/intl/id/gmail/about/#
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.