【问题标题】:How to change URL in Selenium without opening new tab (python)?如何在不打开新标签(python)的情况下更改 Selenium 中的 URL?
【发布时间】:2020-09-29 13:36:19
【问题描述】:

我在 java 中看到了一些 .navigate() 函数,但它不是在 python 中。

那么,如何在不打开新标签的情况下更改当前打开的窗口的 URL?

【问题讨论】:

    标签: python selenium url webdriver


    【解决方案1】:

    只需再次致电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/#
    

    【讨论】:

      最近更新 更多