When trying to locate elements on this particular page and place them in Objects (DomElement) for testing purposes, I encountered an issue with the reg-error-yid element. This element is nested inside the yid-field-suggestion div, and despite my attempts to use getElementById, byName, byXPath, getFirstByXPath, as well as changing from webClient to WebDriver and utilizing
driver.findElement(By.className("oneid-error-message"))
, none of these methods proved successful.
The registered message element:
<div id="reg-error-yid" class="oneid-error-message" data-error="messages.IDENTIFIER_EXISTS" role="alert">A Yahoo account already exists with this email address. <a href="https://login.yahoo.com/?intl=xa&lang=en-JO&src=ym&.intl=xa&specId=yidReg&.done=https%3A%2F%2Fmail.yahoo.com&nr=1&step=2&.crumb=qP.UnkGzfkR&login=abtallaldigital">Sign in</a>.</div>
My code snippet:
final HtmlPage page1 = webClient.getPage("https://login.yahoo.com/account/create?specId=yidReg&lang=en-JO&src=ym&done=https%3A%2F%2Fmail.yahoo.com&display=login&intl=xa");
final DomElement firstName = page1.getElementById("usernamereg-firstName");
final DomElement emailAddress = page1.getElementById("usernamereg-yid");
final DomElement takenMsg = page1.getElementById("reg-error-yid");