Difference between @findByMethod and @findelement?

Answer Posted / ram

findElement() :

-Find the first element within the current page using the given "locating mechanism".
-Returns a single WebElement.
-Syntax: WebElement findElement(By by).
–will throw "NoSuchElementException" if no matching element found

findElements() :

-Find all elements within the current page using the given "locating mechanism".
-Returns List of WebElements.
-Syntax: java.util.List<WebElement> findElements(By by)
–will return a empty list if no matching elements found and no exception will be thrown

Is This Answer Correct ?    6 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is assert command different from verify command?

507


How to pass parameters using testng.xml?

485


What is the difference b/w close () and quit ()?

548


What is difference between assert and verify commands?

460


What do we mean selenium selenium 1 and 2?

502






Write a code to wait for a particular element to be visible on a page. Write a code to wait for an alert to appear.

727


List the parameters that one needs to pass in selenium.

445


What are the main advantages of selenium?

494


Differentiate between ‘/’ and ‘//’.

541


What are the different types of annotations which are used in selenium?

460


How to achieve database testing in selenium?

512


What is the alternative to driver.get() method to open an url using selenium webdriver?

756


What is the selenium webdriver?

520


How to perform right click using selenium webdriver?

444


What is the super interface of webdriver?

599