Difference between @findByMethod and @findelement?




Answers were Sorted based on User's Feedback



Difference between @findByMethod and @findelement?..

Answer / elakkiya

Both methods are used to find the webelements.

findelement:
-------------------

This is one of the abstract method , should be used to find the single web element.
Return type is single web element.

@Findby:
--------------
This is one Annotation in Page factory model and used to locate one or more WebElements using a single criterion.

it has two kind of methods as follows.

• The @FindBys annotation is used in case elements need to match all of the given criteria
• The @FindAll annotation is used in case elements need to match at least one of the given criteria

Is This Answer Correct ?    5 Yes 0 No

Difference between @findByMethod and @findelement?..

Answer / raam

@findby is a testng class,normally we use it in pageclass,
using this we can directly call the webelement

ex
:
----------------------
@findby(driver.findElement(By.xpath(!@#$%%))

WebElement name;
--------------------------
using name we can easily call the webelement

Is This Answer Correct ?    7 Yes 4 No

Difference between @findByMethod and @findelement?..

Answer / 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 12 No



Post New Answer



More Selenium Interview Questions

Tell us how can you run selenium server other than the default port 4444?

0 Answers  


Other than the default port 444 how you can run selenium server?

0 Answers  


What are the limitations of using selenium as a test tool?

0 Answers  


What are the different exceptions you got when working with webdriver?

0 Answers  


How to upload a file in selenium webdriver?

0 Answers  






Explain what is the difference between borland silk and selenium?

0 Answers  


in real time, where do u log defects using selenium?

1 Answers   JPMorgan Chase,


What is the wait?

0 Answers  


Mention 5 different exceptions you had in selenium web driver?

0 Answers  


How you can login into any site if it’s showing any authentication popup for password and username?

0 Answers  


How to conduct database testing with selenium webdriver?

0 Answers  


How to check if an element is visible on the web page?

0 Answers  






Categories