Navigating to a new page through Selenium in Python

回眸只為那壹抹淺笑 提交于 2020-05-16 05:17:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!