Playwright vs Selenium WebDriver Syntax Comparison by Example

Raw Selenium WebDriver with Ruby Binding is much better.

driver.find_element(:id, username).send_keys("agileway")
driver.find_element(:name, username).send_keys("testwise")
driver.find_element(:xpath, "//input[@value='Sign in']").click
expect(driver.find_element(:tag_name, "body").text).to include("Signed in")
await driver.fill("#username", "agileway")
await driver.fill("#password", "testwise")
await driver.click("input:has-text('Sign in')")
await driver.textContent("body").then(function(body_text) {
assert(body_text.contains("Signed in"))
})
LoginPage login_page = LoginPage.new(driver)
login_page.enter_username("agileway")
login_page.enter_password("testwise")
login_page.click_sign_in
expect(page_text).to include("Signed in")
Maintainable Automated Test Design

From Microsoft Test Guru Alan Page, coauthor of “How We Test Software at Microsoft” book

“For 95% of all software applications, automating the GUI is a waste of time. For the record, I typed 99% above first, then chickened out. I may change my mind again”
- Alan’s blog (2008)

“95% of the time, 95% of test engineers will write bad GUI automation just because it’s a very difficult thing to do correctly”.
- this interview (2015)

And from Robert C. Martin, co-author of the Agile Manifesto:

“Automated testing through the GUI is intuitive, seductive, and almost always wrong!
- his blog (in 2009)

From Gerald Weinberg, a software legend:

“Testing is harder than developing. If you want to have good testing you need to put your best people in testing.”
- in podcast (2018)

“Facebook is released twice a day, and keeping up this pace is at the heart of our culture. With this release pace, automated testing with Selenium is crucial to making sure everything works before being released.” — DAMIEN SERENI, Engineering Director at Facebook, at Selenium 2013 conference.

A run of ClinicWise End-to-End Suite: 611 raw Selenium Tests
A recent run of WhenWise end-to-end suite: 559 raw Selenium Tests
A recent run of TestWise suite: 310 raw Appium + WinAppDriver tests
From this tweet: https://twitter.com/matteocollina/status/1603307940949155840

By the way, Selenium and Playwright are the two approved test automation frameworks in this company.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store