1

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

0

2 Answers 2

5

To navigate to a webpage you just write

driver.get(__url__)

you can do this in your program multiple times

Sign up to request clarification or add additional context in comments.

Comments

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})

4 Comments

Actually when I run get(url), a new window pops up
As per the Selenium Java Client implementation get()/navigate().to() invokes the same call. It would be wiser to deal with the popups.
@user3623123: if you say you get a new window everytime you call get, please update your question with a minimal reproducible example. I do not think you should be getting that behavior so maybe the problem is in how you are using it.
From what I have experienced, .get() behaves more like creating a new browser instance that will forget/delete all previous cookies and sessions. This is bad if you are logged in somewhere and try to navigate to a different page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.