lesson6_step5.py 770 B

123456789101112131415161718192021222324252627282930
  1. from selenium import webdriver
  2. import time
  3. import math
  4. link = "http://suninjuly.github.io/find_link_text"
  5. try:
  6. browser = webdriver.Chrome()
  7. browser.get(link)
  8. link2 = browser.find_element_by_partial_link_text(str(math.ceil(math.pow(math.pi, math.e)*10000)))
  9. link2.click()
  10. input1 = browser.find_element_by_tag_name("input")
  11. input1.send_keys("Ivan")
  12. input2 = browser.find_element_by_name("last_name")
  13. input2.send_keys("Petrov")
  14. input3 = browser.find_element_by_class_name("city")
  15. input3.send_keys("Smolensk")
  16. input4 = browser.find_element_by_id("country")
  17. input4.send_keys("Russia")
  18. button = browser.find_element_by_css_selector("button.btn")
  19. button.click()
  20. time.sleep(5)
  21. assert
  22. finally:
  23. browser.quit()