-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaboba.py
27 lines (23 loc) · 920 Bytes
/
aboba.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
link = "http://suninjuly.github.io/find_xpath_form"
browser = webdriver.Chrome()
try:
browser.get(link)
input1 = browser.find_element(By.TAG_NAME, 'input')
input1.send_keys("I")
input2 = browser.find_element(By.NAME, 'last_name')
input2.send_keys("Love")
input3 = browser.find_element(By.CLASS_NAME, 'city')
input3.send_keys("Big")
input4 = browser.find_element(By.ID, "country")
input4.send_keys("Penis")
button = browser.find_element(By.XPATH, "//button[text()='Submit']")
button.click()
finally:
# успеваем скопировать код за 30 секунд
time.sleep(30)
# закрываем браузер после всех манипуляций
browser.quit()
# не забываем оставить пустую строку в конце файла