Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不打开新选项卡(python)的情况下更改Selenium中的URL?_Python_Selenium_Url_Webdriver - Fatal编程技术网

如何在不打开新选项卡(python)的情况下更改Selenium中的URL?

如何在不打开新选项卡(python)的情况下更改Selenium中的URL?,python,selenium,url,webdriver,Python,Selenium,Url,Webdriver,我在java中看到了一些.navigate()函数,但在python中没有 那么,我如何在不打开新选项卡的情况下更改当前打开窗口的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)

我在java中看到了一些.navigate()函数,但在python中没有

那么,我如何在不打开新选项卡的情况下更改当前打开窗口的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)
输出:

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