I am tryting to get the element using the link text but unable to find the element getting error regarding the linktext
In automation testing company we perform different approaches to find/get the web-element. In your case link text is not working because there is space before " My Account" text.
So you can use Below approaches that can help you
1.driver.findElement(By.xpath(//ul[@class='mega-menu']//li//a//span(contains(text(),'My Account'))); 2.driver.findElement(By.partialLinkText("My Account")); 3.driver.findElement(By.LinkText(" My Account"));