Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Selenium - Page Navigation | Browser Automation with Selenium
Introduction to QA Automation Testing
course content

Kursinnhold

Introduction to QA Automation Testing

Introduction to QA Automation Testing

1. Introduction to Automation Testing
2. Using a Test Automation Framework
3. Browser Automation with Selenium
4. Intro to Intermediate Automation Testing

book
Selenium - Page Navigation

Summary

Here we have some code from the previous chapter.

const { Builder, By, until } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const path = require('path');

(async () => {

    let chromeDriverPath = path.resolve('C:/Users/AIMS TECH/Desktop/selenium-tests/chromedriver.exe');
    let service = new chrome.ServiceBuilder(chromeDriverPath);

    let options = new chrome.Options()
        .addArguments('--disable-search-engine-choice-screen')
        .addArguments('--lang=en-GB');

    let driver = await new Builder()
        .forBrowser('chrome')
        .setChromeService(service)
        .setChromeOptions(options)
        .build();
        
})();

As a quick recall, this code configures the browser with the following options and launches a new instance of it. However it doesn't go to any specific URL.

There are two different ways of navigating to a URL. The first method is by using the get method, which simply searches for the specified URL and displays the page.

driver.get('https://www.google.com');

The other method is to use the navigate method.

driver.navigate().to('https://www.google.com');

The navigate method provides a few more options as well. It lets us go to the previous and the next pages using next and back methods.

// Go to the previous page
driver.navigate().back();

// Go back to the forward page
driver.navigate().forward();

Moreover, it also provides a method called refresh for refreshing the page.

driver.navigate().refresh();

The refresh() method can be fairly useful in the context of testing.

question mark

Which of the two methods have the same functionality ?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 3

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

course content

Kursinnhold

Introduction to QA Automation Testing

Introduction to QA Automation Testing

1. Introduction to Automation Testing
2. Using a Test Automation Framework
3. Browser Automation with Selenium
4. Intro to Intermediate Automation Testing

book
Selenium - Page Navigation

Summary

Here we have some code from the previous chapter.

const { Builder, By, until } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const path = require('path');

(async () => {

    let chromeDriverPath = path.resolve('C:/Users/AIMS TECH/Desktop/selenium-tests/chromedriver.exe');
    let service = new chrome.ServiceBuilder(chromeDriverPath);

    let options = new chrome.Options()
        .addArguments('--disable-search-engine-choice-screen')
        .addArguments('--lang=en-GB');

    let driver = await new Builder()
        .forBrowser('chrome')
        .setChromeService(service)
        .setChromeOptions(options)
        .build();
        
})();

As a quick recall, this code configures the browser with the following options and launches a new instance of it. However it doesn't go to any specific URL.

There are two different ways of navigating to a URL. The first method is by using the get method, which simply searches for the specified URL and displays the page.

driver.get('https://www.google.com');

The other method is to use the navigate method.

driver.navigate().to('https://www.google.com');

The navigate method provides a few more options as well. It lets us go to the previous and the next pages using next and back methods.

// Go to the previous page
driver.navigate().back();

// Go back to the forward page
driver.navigate().forward();

Moreover, it also provides a method called refresh for refreshing the page.

driver.navigate().refresh();

The refresh() method can be fairly useful in the context of testing.

question mark

Which of the two methods have the same functionality ?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 3
some-alt