问题
How do I navigate to another webpage using the same driver with Selenium in python? I do not want to open a new page. I want to keep on using the same driver. I thought that the following would work:
driver.navigate().to("https://support.tomtom.com/app/contact/")
But it doesn't! Navigate seems not to be a 'WebDriver' method
回答1:
To navigate to a webpage you just write
driver.get(__url__)
you can do this in your program multiple times
回答2:
The line of code which you have tried as :
driver.navigate().to("https://support.tomtom.com/app/contact/")
It is a typical Java based line of code.
However as per the currect Python API Docs of The WebDriver implementation navigate() method is yet to be supported/implemented.
Indtead, you can use the get(url) method instead which is defined as :
def get(self, url):
"""
Loads a web page in the current browser session.
"""
self.execute(Command.GET, {'url': url})
来源:https://stackoverflow.com/questions/49355434/navigating-to-a-new-page-through-selenium-in-python