Skip to content Skip to sidebar Skip to footer

How To Locate Element With Tag Alert Inside Outer Div

I trying to locate elemnts in this page and put it in Objects (DomElement) to making some tests of it, the problem is with elemnt reg-error-yid it is a inner-div inside div yid-fie

Solution 1:

I am not sure about your need. I can't comment here.

But if you are trying to parse the document you can use Jsoup for parsing the document.

The select is more useful and easy as compared to getElementById, byName, byXPath.

org.jsoup.nodes.Document doc = Jsoup.connect("https://login.yahoo.com/account/create?specId=yidReg&lang=en-JO&src=ym&done=https%3A%2F%2Fmail.yahoo.com&display=login&intl=xa").get();
org.jsoup.select.Elements takenMsgs = doc.select("div[id=reg-error-yid]");
org.jsoup.select.Element takenMsgFirst = doc.select("div[id=reg-error-yid]").first;

See if you can convert org.jsoup.select.Elements to com.gargoylesoftware.htmlunit.html.DomElement


Post a Comment for "How To Locate Element With Tag Alert Inside Outer Div"