Selenium 4 New Features by Examples in Ruby

Zhimin Zhan
4 min readMar 27, 2021

Selenium WebDriver 4 Beta is released and I updated my parallel testing lab to use Selenium 4. In the article, I will show what’s new in Selenium 4 with examples (in Ruby binding). I will focus on the core test framework (matters to test scripts), excluding optional components such as Selenium IDE and Selenium Grid.

There are many articles/blog posts on “Selenium 4 New Features” (such as the ones in DZone and SauceLabs Blog), but I haven’t seen the official one except for some talks by Simon Stewart, like this one.

I like learning by doing, here are some quick examples I came up with.

If you own the Selenium WebDriver Recipes in Ruby ebook, you can get a set of Selenium 4 recipe test scripts on the book site now. The content is yet to be added to the ebook.

1. Relative Locators

Relative Locators have been touted as the key Selenium 4 feature. However, there were very limited examples of relative locators. I searched for the Selenium repository (Ruby), with only 10 references in one integration test file.

I will write a separate article on using relative locators. For now, I will share one: “to the right of a fixed element”.

start_cell = driver.find_element(id: "test_products_only_flag")
elem_label =…

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.