Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in DevOps and Agile by (19.4k points)

I'm trying to get the current url after a series of navigations in Selenium. I know there's a command called getLocation for ruby, but I can't find the syntax for Python.

2 Answers

+1 vote
by (27.5k points)
edited by

Different approaches to refresh the application in Selenium:-

  • driver.navigate().refresh();
  • driver.get(driver.getCurrentUrl());
  • driver.navigate().to(driver.getCurrentUrl());
  • driver.findElement(By.id("Contact-us")).sendKeys(Keys.F5); 
  • driver.executeScript("history.go(0)");

For more information please go through the following tutorial to get more info about selenium:

 

+1 vote
by (62.9k points)

There are five other ways to refresh a webpage using Selenium Webdriver

I have simply used the prevailing functions in numerous ways in which to get it to work.

Here they are :

1.Using sendKeys.Keys method

driver.get("https://accounts.google.com/SignUp");

driver.findElement(By.id("firstname-placeholder")).sendKeys(Keys.F5);

2.Using navigate.refresh() method

driver.get("https://accounts.google.com/SignUp");

driver.navigate().refresh();

3.Using navigate.to() method

driver.get("https://accounts.google.com/SignUp");

driver.navigate().to(driver.getCurrentUrl());

4.Using get() method

driver.get("https://accounts.google.com/SignUp");

driver.get(driver.getCurrentUrl());

5.Using sendKeys() method

driver.get("https://accounts.google.com/SignUp");

driver.findElement(By.id("firstname-placeholder")).sendKeys("");

Hope this helps!

Browse Categories

...