We will have a look at a few of the very important and frequently used methods and their signatures.
These are methods invoked by the WebDriver instance:
- findElement(By) versus findElements(By): Both these methods take an argument of type By. The findElement method calls the FindElements method and returns a WebElement. If multiple elements are found with the same locator, it returns the first WebElement. The findElements, on the other hand, returns a list of WebElements. The findElement throws a NoSuchElementException if it is unable to find an element using the locator provided in the parameter list. The findElements returns an empty list if no elements are found using the given locator.
- get(String): The get method takes a String URL as a parameter. It navigates to the URL supplied as a parameter. The URL can be in the form of http://www.google...