Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By
- import org.openqa.selenium.Keys
- import org.openqa.selenium.firefox.FirefoxDriver
- import org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable
- import org.openqa.selenium.support.ui.WebDriverWait
- import java.nio.file.Files
- import java.nio.file.Paths
- import java.util.concurrent.ThreadLocalRandom
- import kotlin.concurrent.thread
- fun main(args: Array<String>) {
- val phrases = Files.readAllLines(Paths.get("phrases.txt"))
- for (line in Files.readAllLines(Paths.get("creds.txt"))) thread {
- val split = line.split(":")
- with(FirefoxDriver()) {
- navigate().to("https://www.rune-server.org/forums.php")
- val eUsername = findElement(By.name("vb_login_username"))
- eUsername.sendKeys(split[0])
- eUsername.sendKeys(Keys.TAB)
- val ePassword = findElement(By.id("navbar_password"))
- ePassword.sendKeys(split[1])
- val eRememberMe = findElement(By.id("cb_cookieuser_navbar"))
- eRememberMe.click()
- val eLoginButton = findElement(By.className("loginbutton"))
- eLoginButton.click()
- val eShoutbox = WebDriverWait(this, Int.MAX_VALUE.toLong())
- .until(elementToBeClickable(By.id("vbshout_pro_shoutbox_editor")))
- while (!Thread.interrupted()) {
- eShoutbox.sendKeys(phrases[ThreadLocalRandom.current().nextInt(phrases.size)])
- eShoutbox.sendKeys(Keys.ENTER)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement