1. What is the purpose of the navigate() interface in Selenium?
navigate() interface provides methods to move back, forward, refresh, and go to specific URLs.
2. How do you go to the specific web page using the navigate() interface method?
driver.navigate().to(“https://www.food.com”);
3. Can you use the relative URL to navigate to a new web page?
Yes.
driver.navigate().to(“/ralativePath”);
4. Does the navigate.to() method refresh the page?
No. It is used to navigate into a specific URL.
5.Which command takes you forward by one page in the browser history?
The navigate().forward() command takes you forward by one page (previous page) on the browser’s history. This method enables the browser to click on the forward button in the existing browser window.
6. How do use navigate back and forward in the code?
- driver.navigate().back();
- driver.navigate().forward();
7.What is the difference between the navigate().to() and get() methods in Selenium?
- both methods are used to go to specific URLs.
- driver.get() method is synchronous.
- so it waits for everything on the page to be loaded before interacting with the elements.
- While navigate().to() is asynchronous it doesn’t wait for everything on the page to load.
8. How to refresh the page using Selenium?
- driver.navigate().refresh();
- sendKeys(Keys.F5) in text box
- driver.get(url)
- driver.getCurrentURL()
- driver.navigate().to(driver.getCurrentURL)
No comments:
Post a Comment