Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.concurrent.TimeUnit;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.firefox.FirefoxDriver;
- public class SytheBump {
- // private final static GUI2 GUI2 = new GUI2();
- private static String username = "haha";
- private static String password = "xD";
- static WebDriver driver = null;
- public static void main(String[] args) {
- // GUI2.setVisible(true);
- try {
- Thread.sleep((0 * 60 + 0) * 60000);
- while (true) {
- // File pathBinary = new File(
- // "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
- // FirefoxBinary Binary = new FirefoxBinary(pathBinary);
- // FirefoxProfile firefoxPro = new FirefoxProfile();
- // driver = new FirefoxDriver(Binary, firefoxPro);
- driver = new FirefoxDriver();
- driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
- driver.manage().window().maximize();
- driver.get("http://www.sythe.org/login/");
- Thread.sleep(12000);
- WebElement name = driver.findElement(By.name("login"));
- if (name != null) {
- name.sendKeys(username);
- } else {
- System.out.println("Error 1 logging in!");
- continue;
- }
- WebElement pass = driver.findElement(By.name("password"));
- if (pass != null) {
- pass.sendKeys(password);
- } else {
- System.out.println("Error 2 logging in!");
- continue;
- }
- WebElement button = driver
- .findElement(By
- .cssSelector("#pageLogin > dl.ctrlUnit.submitUnit > dd > input"));
- if (button != null) {
- button.click();
- } else {
- System.out.println("Error 3 logging in!");
- continue;
- }
- for (Link l : Link.values()) {
- driver.get(l.getPostLink());
- Thread.sleep(5500);
- WebElement button2 = driver
- .findElement(By
- .cssSelector("#QuickReply > div.submitUnit > input.button.DisableOnSubmit"));
- if (button2 != null) {
- button2.click();
- } else {
- System.out.println("Error 3 for" + l.name());
- continue;
- }
- WebElement button34 = driver
- .findElement(By.tagName("body"));
- if (button34 != null) {
- button34.click();
- } else {
- System.out.println("Error 1 for" + l.name());
- continue;
- }
- WebElement button3 = driver.findElement(By
- .tagName("iframe"));
- if (button3 != null) {
- button3.sendKeys(l.getMessage());
- } else {
- System.out.println("Error 5 for" + l.name());
- continue;
- }
- WebElement button4 = driver
- .findElement(By
- .cssSelector("#ThreadReply > dl.ctrlUnit.submitUnit > dd > input.button.primary"));
- if (button4 != null) {
- button4.click();
- } else {
- System.out.println("Error 2 for" + l.name());
- continue;
- }
- Thread.sleep(6500);
- }
- driver.quit();
- Thread.sleep(28788000 - (Link.values().length * 17000));
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (driver != null) {
- driver.quit();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment