From: Fab B. <swo...@ho...> - 2013-11-26 20:23:01
|
Hi, I'm trying to build a application on Facebook with HtmlUnit, So I want to log my profile, post contents on my wall and on groups pages. I have no problem with the login procedure (I find the text boxes, i fill them with name and password and I call "click" on the button. But I have problem with groups: I fail to grab the text box where I have to write the message. http://oi43.tinypic.com/28vszr6.jpg I proceed this way: java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel( java.util.logging.Level.OFF); WebClient client = new WebClient(BrowserVersion.getDefault()); //log procedure... page = webClient.getPage("page_url"); page.getElementByName("xhpc_message_text"); the last line throws an exception or returns null: HtmlUnit fails to find the element. I tried with the id (u_0_3a in this case) but it changes every time, the name is always the same, so that's why I using name instead of id. How can I get the textbox element? The second problem is with the format in which facebook publish my content, A normal post shows a title an icon etc. If I use HtmlUnit to fill the box end click on the button to post it, fb shows only the string. http://oi42.tinypic.com/2z703k0.jpg How can I fix it? I hope that someone have an answer for these problems. |