Is there a way to identify the link residing in an email body template using selenium webdriver?
I was trying to automate a scenario where I will receive an email with a body having a link to click to complete the registration process.
Using a public mail server I was able to login into a web-based email provider with Selenium. I clicked on the email which I received but web driver was not able to identify the link using ID webelement locator enclosed in the email body template. After execution I am ending up with the following error:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"enrollmentURL"}
HTML of email link:
<a id="enrollmentURL" href="click1.clickrouter.com/…; style="font-family: "arial" , "helvetica" , sans-serif ; font-size: 16px ; line-height: 16px ; color: #fff ; text-decoration: none ; display: block" target="_other" rel="nofollow"><strong>GET STARTED</strong></a>
Code:
Generic.waitForElement(malinatoremailid,1,driver);
Generic.click(malinatoremailid,driver);
Generic.enterText(malinatoremailid,map.get(0).get("Email"),driver);
Generic.click(go,driver); Generic.waitForElement(email,2,driver);
Generic.click(email,driver);