From: Torak t. <sni...@gm...> - 2014-03-17 17:52:58
|
ok new script. all files imported the right way and error fixed: import java.io.IOException; import java.net.MalformedURLException; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Display; import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; public class BotStart { public static void main(String[] args) throws Exception, FailingHttpStatusCodeException, MalformedURLException, IOException { Display display = new Display(); Shell myshell = new Shell(display); myshell.setText("adf.ly BOT 0.1"); myshell.open(); while (!myshell.isDisposed()) { final WebClient webClient = new WebClient(BrowserVersion.CHROME); final HtmlPage page1 = webClient.getPage("http://adf.ly/ftDpz"); final HtmlInput button = page1.getElementById("skip_ad_button") final HtmlPage page2 = button.click(); //some more stuff in here :) webClient.closeAllWindows(); if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } but as you can probably see there is another problem. i dont know if your meant to use HtmlUnit for Botting purposes but i thought id test it out. my bot needs to : get to my adfly link ( shown above) get the skip ad button, wait 5 seconds, then click it. but in order to do the button.click() you need to have a htmlInput, which does not work directly from a html page ie: final HtmlInput button = page1.getElementById("skip_ad_button") idk what htmldivision does but if anyone can tell me how to make it work so that button is the obtained element id. It also keeps saying "obsolete data type encountered: text/javascript" if anyone knows how to fix that. sorry for the bother. ik ur all sick of me now :( |