Skip to main content
1 of 2
Syrus
  • 1.2k
  • 4
  • 17
  • 32

I found the solution for the problem. I just had to add single line of code to make this work.

MyClass object= PageFactory.initElements(driver, MyClass.class);       
 

I had to add this code to the class where I was creating the test and tried. It worked. Error wasn't in using of "@FindBy". So I guess this will help someone in future.

Syrus
  • 1.2k
  • 4
  • 17
  • 32