簡體   English   中英

如何在不打開新標簽(python)的情況下更改Selenium中的URL?

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

我在 java 中看到一些.navigate()函數可以做到這一點,但它不在 python 中。

那么,如何在不打開新標簽的情況下,只更改當前打開的 window 的 URL 呢?

只需再次調用driver.get('yourURL') 例子:

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/#

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM