Advertisement
Guest User

Untitled

a guest
Jul 5th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. import org.openqa.selenium.By
  2. import org.openqa.selenium.Keys
  3. import org.openqa.selenium.firefox.FirefoxDriver
  4. import org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable
  5. import org.openqa.selenium.support.ui.WebDriverWait
  6. import java.nio.file.Files
  7. import java.nio.file.Paths
  8. import java.util.concurrent.ThreadLocalRandom
  9. import kotlin.concurrent.thread
  10.  
  11. fun main(args: Array<String>) {
  12. val phrases = Files.readAllLines(Paths.get("phrases.txt"))
  13. for (line in Files.readAllLines(Paths.get("creds.txt"))) thread {
  14. val split = line.split(":")
  15.  
  16. with(FirefoxDriver()) {
  17. navigate().to("https://www.rune-server.org/forums.php")
  18.  
  19. val eUsername = findElement(By.name("vb_login_username"))
  20. eUsername.sendKeys(split[0])
  21. eUsername.sendKeys(Keys.TAB)
  22.  
  23. val ePassword = findElement(By.id("navbar_password"))
  24. ePassword.sendKeys(split[1])
  25.  
  26. val eRememberMe = findElement(By.id("cb_cookieuser_navbar"))
  27. eRememberMe.click()
  28.  
  29. val eLoginButton = findElement(By.className("loginbutton"))
  30. eLoginButton.click()
  31.  
  32. val eShoutbox = WebDriverWait(this, Int.MAX_VALUE.toLong())
  33. .until(elementToBeClickable(By.id("vbshout_pro_shoutbox_editor")))
  34.  
  35. while (!Thread.interrupted()) {
  36. eShoutbox.sendKeys(phrases[ThreadLocalRandom.current().nextInt(phrases.size)])
  37. eShoutbox.sendKeys(Keys.ENTER)
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement