test_quick.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Generated by Selenium IDE
  2. import pytest
  3. import time
  4. import json
  5. from selenium import webdriver
  6. from selenium.webdriver.common.by import By
  7. from selenium.webdriver.common.action_chains import ActionChains
  8. from selenium.webdriver.support import expected_conditions
  9. from selenium.webdriver.support.wait import WebDriverWait
  10. from selenium.webdriver.common.keys import Keys
  11. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  12. class TestQuick():
  13. def setup_method(self, method):
  14. chrome_options = webdriver.ChromeOptions()
  15. chrome_options.add_argument('--headless')
  16. chrome_options.add_argument('--no-sandbox')
  17. self.driver = webdriver.Chrome(options=chrome_options)
  18. self.vars = {}
  19. def teardown_method(self, method):
  20. self.driver.quit()
  21. def test_quick(self):
  22. # Test name: quick
  23. # Step # | name | target | value
  24. # 1 | open | / |
  25. self.driver.get("http://example.com/")
  26. # 2 | setWindowSize | 1608x911 |
  27. self.driver.set_window_size(1608, 911)
  28. # 3 | click | linkText=Log in |
  29. self.driver.find_element(By.LINK_TEXT, "Log in").click()
  30. # 4 | click | id=edit-name |
  31. self.driver.find_element(By.ID, "edit-name").click()
  32. # 5 | type | id=edit-name | username
  33. self.driver.find_element(By.ID, "edit-name").send_keys("username")
  34. # 6 | type | id=edit-pass | changeme#
  35. self.driver.find_element(By.ID, "edit-pass").send_keys("changeme")
  36. # 7 | click | id=block-olivero-page-title |
  37. self.driver.find_element(By.ID, "block-olivero-page-title").click()
  38. # 8 | click | name=op |
  39. self.driver.find_element(By.NAME, "op").click()
  40. # 9 | click | id=toolbar-item-user |
  41. self.driver.find_element(By.ID, "toolbar-item-user").click()
  42. # 10 | click | linkText=Log out |
  43. self.driver.find_element(By.LINK_TEXT, "Log out").click()
  44. # 11 | close | |
  45. self.driver.close()