[Solved] Selenium @FindBy linkText or @FindBy partialLinkText not working


As per the HTML you have shared you can use either of the following solutions:

  • linkText:

    @FindBy(linkText = "My transfer")
    WebElement transferBtn;
    
  • partialLinkText:

    @FindBy(partialLinkText = "transfer")
    WebElement transferBtn;
    
  • xpath:

    @FindBy(xpath  = "//a[contains(.,'My transfer')]")
    WebElement transferBtn;
    

solved Selenium @FindBy linkText or @FindBy partialLinkText not working