if you use node selenium-webdriver to do a basic UI test, here is a quick sample code to open google, enter the keyword and do the serach, then validate the title. https://www.npmjs.org/package/selenium-webdriver
after this, run again, make sure we never break any logic. can we still improve it?
we have to key in the whole helper method webdriver.By.name, let’s improve it. create another module called makenameselector.js
now in the test.js , we can promote the selector string to nameselctors.
then no more hardcoding, no more duplicate webdriver.By.name