Guest User

Untitled

a guest
Jan 23rd, 2024
279
0
252 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.chrome.options import Options
  4. import time
  5.  
  6. # Setup Chrome options for incognito mode
  7. chrome_options = Options()
  8. chrome_options.add_argument("--incognito")
  9. chrome_options.add_argument("--headless")
  10.  
  11. # Function to perform the actions
  12. def perform_actions():
  13.     # Setup the WebDriver with incognito mode
  14.     driver = webdriver.Chrome('/usr/local/bin/chromedriver', options=chrome_options)
  15.    
  16.     driver.get('https://poll.fm/13231960')
  17.  
  18.     try:
  19.         # Find the player you want to vote for ;)
  20.         radio_button = driver.find_element(By.ID, 'PDI_answer59291850')
  21.         radio_button.click()
  22.  
  23.         # Click on vote
  24.         href_button = driver.find_element(By.ID, 'pd-vote-button13231960')
  25.         href_button.click()
  26.  
  27.         # Wait for however many seconds you want. I chose 5.
  28.         time.sleep(5)
  29.  
  30.         # Go back to the poll
  31.         driver.get('https://poll.fm/13231960')
  32.  
  33.     except Exception as e:
  34.         print("An error occurred:", e)
  35.     finally:
  36.         # Close the browser window
  37.         driver.quit()
  38.  
  39. # Repeat the process
  40. while True:
  41.     perform_actions()
Add Comment
Please, Sign In to add comment