The Agile Way

The Agile Way

Share this post

The Agile Way
The Agile Way
21 Verify Logged out Properly & Run the same against against two different browsers
Selenium Training Workbook

21 Verify Logged out Properly & Run the same against against two different browsers

How to run tests across different browsers in Selenium WebDriver

Courtney Zhan's avatar
Courtney Zhan
Aug 01, 2023
∙ Paid
1

Share this post

The Agile Way
The Agile Way
21 Verify Logged out Properly & Run the same against against two different browsers
Share

Learning Objectives

  • Verify a simple and obvious operation, such as logout

  • Browser navigation in Selenium WebDriver

  • Run the same automated test against different browsers, e.g. Chrome, Firefox, etc. Get concept of Cross Browser Testing

  • Test Execution set up for different browsers

Test Case #21

In the previous session, we wrote a simple user login test (the simplest and the most common one).

it "Login ok" do
    driver.find_element(:link_text, "SIGN IN").click
    driver.find_element(:id, "email").send_keys("yoga@biz.com")
    driver.find_element(:id, "password").send_keys("test01")
    driver.find_element(:xpath, "//input[@id='remember_me']/../span").click
    driver.find_element(:id, "login-btn").click
    expect(page_text).to include("You have signed in successfully")
    visit("/sign-out") # logout
  end

We verified “Logged in” by checking the text You have signed in successfully. But did we verify the logged out? NO.

Test Design

There are several ways to verify user logout. Here I propose one (might sound complex, but for education purposes).

  • The user Logs out (either click the logout link or enter a direct /sign-out URL)

  • Clicks the back button in the browser to navigate back to its previous page, showing the user is still logged in (which is fine)

  • Click the refresh button

  • Should be on the login page (as signed out), verify by the current web address (URL)

Task 1: Basic browser navigation

  1. Browser back
    driver.navigate.back

  2. Refresh the browser
    driver.navigate.refresh

  3. Get the current URL (web address)
    driver.current_url

Keep reading with a 7-day free trial

Subscribe to The Agile Way to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Zhimin Zhan
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share