Advertisement
Razorspined

Untitled

Nov 13th, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. from seleniumrequests import Chrome
  2. from selenium.webdriver.common.keys import Keys
  3. from selenium.webdriver.common.by import By
  4.  
  5. driver = Chrome('D:/Coding/chromedriver_win32/chromedriver.exe')
  6. driver.get("http://localhost")
  7.  
  8. # username = driver.find_element(By.NAME, "username")
  9. # password = driver.find_element(By.NAME, "password")
  10.  
  11. # username.send_keys('admin')
  12. # password.send_keys('password')
  13. # password.send_keys(Keys.ENTER)
  14.  
  15. token = driver.find_element(By.NAME, "user_token")
  16.  
  17. user_details = {
  18. "username": "admin",
  19. "password": "password",
  20. "user_token": token.get_attribute("value")
  21. }
  22.  
  23. response = driver.request("POST", "http://localhost/login.php", data=user_details)
  24.  
  25. print(response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement