Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.61 KB | None | 0 0
  1. require "selenium-webdriver"
  2.  
  3. $sayings = [
  4.     "Who is the one they call highlander?",
  5.     "I must speak with the queen.",
  6.     "My fortune is great in the kingdom of Camelot",
  7.     "Today I am potato, tomorrow I am feminist.",
  8.     "My foot just fell asleep someone call the police!",
  9.     "This is incredible.",
  10.     "I am as nine-thousand mermaids swimming in unison.",
  11.     "No photographs, please.", "Geistgeld to the moooon!",
  12.     "I am a bassplayer in band everyone here has heard of.",
  13.     "Im about to hypothetical you in the clavical",
  14.     "Draxx them sklounst!",
  15.     "Wololooooo!",
  16.     "Satoshi is a poser."]
  17.  
  18. $potato = "i AM potato"
  19.  
  20. class Troller
  21.  
  22.     def initialize
  23.  
  24.         #Login!
  25.         @driver = Selenium::WebDriver.for :chrome
  26.         @driver.navigate.to "https://poloniex.com"
  27.  
  28.         @driver.find_element(:xpath, "/html/body/div/div[2]/div[3]/ul/li[1]/span/a[1]").click
  29.  
  30.         username = @driver.find_element(:xpath, "//*[@id='username']")
  31.         password = @driver.find_element(:xpath, "//*[@id='password']")
  32.  
  33.         username.send_keys("usr@usr.usr")
  34.         password.send_keys("negros")
  35.  
  36.         @driver.find_element(:xpath, "//*[@id='content']/div/div/div/div[1]/form/button").click
  37.         #Logged in
  38.         @saybox = @driver.find_element(:xpath, "//*[@id='message']")
  39.  
  40.     end
  41.  
  42.  
  43.     def getname
  44.  
  45.     end
  46.  
  47.  
  48.     def spew
  49.         if rand(10) < 8
  50.             say = $sayings.sample
  51.             puts say
  52.             puts say
  53.             @saybox.send_keys say, :return
  54.         else
  55.             puts "potato"
  56.             @saybox.send_keys $potato, :return
  57.         end
  58.     end
  59.  
  60.  
  61.     def record
  62.  
  63.     end
  64.  
  65.  
  66.  
  67. end
  68.  
  69.  
  70.  
  71.  
  72. agent = Troller.new()
  73.  
  74. loop do
  75.     agent.spew
  76.     sleep 10
  77. end
  78. #entries = driver.find_element(:xpath, "//*[@id='trollboxTable']/tbody")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement