Java/Selenium Find Element by ID - Is Selenium looping over Annotations? Java/Selenium Find Element by ID - Is Selenium looping over Annotations? selenium selenium

Java/Selenium Find Element by ID - Is Selenium looping over Annotations?


Is Selenium looping over Annotations? answer is Yes, Selenium loop over the expected WebElement if you are performing some action over it. So in your case if you have mentioned like

@FindBy(id = DIALOGBOX_YES_BTN)private WebElement dialogBoxYesBtn;

So when you try to use this webelement wherever in your script like

dialogBoxYesBtn.click();

The driver will first find it on the current page and then simulate the action on the WebElement. If not found obviously it will throw the exception.

Refer this blog for more.