Advertisement
alphauser420

button

Mar 12th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. import time
  4.  
  5. driver = webdriver.Chrome()
  6. driver.maximize_window()
  7. driver.get("https://omayo.blogspot.com/")
  8.  
  9. # Finding the button element
  10. button = driver.find_element(By.ID, "but2")
  11.  
  12. # Clicking the button
  13. button.click()
  14.  
  15. # Changing the button color to green using JavaScript after clicking
  16. driver.execute_script("arguments[0].style.backgroundColor = 'green';", button)
  17.  
  18. time.sleep(5) # Giving a brief pause to see the changes (not required, but good for demonstration)
  19. driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement