26 Google Maps Address Validation
How to use Google Maps' validated address fields to enter and pick an address
Learning Objectives
Write a simple Create Client test in Selenium WebDriver
Refactoring in TestWise (Extract Page Function)
Enter and Select Autofilled Address by Google Maps
Task 26.1: Add a new Client
This should be familiar to readers who followed lesson 22 of this series— this is just the Create step of CRUD.
Follow the steps in lesson 22 and the above task card to log into the test site (https://whenwise.agileway.net) and add a client.
Remember to skip the address field (i.e. leave it blank and only fill in the other fields for now). We will get to this in part 2 of today’s lesson.
Your test case might look like the one below.
it "Add new Client" do
# after login
driver.get("https://whenwise.agileway.net/clients"
driver.find_element(:id, "new_client_link").click
driver.find_element(:id, "calendar_client_first_name").send_keys("Dom")
driver.find_element(:id, "calendar_client_last_name").send_keys("Smith")
driver.find_element(:id, "calendar_client_mobile").send_keys("0431868588")
driver.find_element(:id, "calendar_client_email").send_keys("dom@gmail.com")
driver.find_element(:id, "client_notes").send_keys("Hi")
driver.find_element(:id, "create_calendar_client_button").click
expect(page_text).to include("Dominic")
end
The above script works, but is hard to maintain (and read). Refactor it.
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.