Combine the methods findElementBy(type,value) and element.click into one single method clickElementBy(type,value)

We can see the method findElementBy(type,value) is followed by element.click many times. And according to the meaning of finding and clicking, we can combine them together into clickElementBy(type,value).

And we will rewrite the methods in "buy_book.rb" as following:

def searchByKeyword (keyword)
searchKeyword=findElementBy("id","twotabsearchtextbox")
searchKeyword.clear
searchKeyword.send_keys keyword
clickElementBy("class", "nav-submit-input")
end
def openTheFirstItemInSearchResult
clickElementBy("xpath", "//div[@id=\"result_0\"]//span[@class=\"lrg bold\"]")
end
def getCurrentItemTitle
@bookTitle=findElementBy("id", "productTitle").text
end