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 to pass parameters using testng.xml?

485


How do you get the current page url?

494


While using click command can you use screen coordinate?

988


What are the types of webdriver apis available in selenium?

1140


List some scenarios which we cannot automate using selenium webdriver?

475






In selenium ide what are the element locators that can be used to locate elements on web page?

450


How recorded command can be edited in ide?

511


What are some limitations of selenium?

487


How to upload a file in selenium webdriver?

515


What are different forms of selenium?

518


What if you have written your own element locator and how would you test it?

634


What is the automation test?

544


How to fetch the current page url in selenium?

659


How many exemptions do you know in selenium webdriver?

489


How do perform drag and drop using selenium webdriver?

434