-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson2_1_step5.py
More file actions
29 lines (23 loc) · 914 Bytes
/
lesson2_1_step5.py
File metadata and controls
29 lines (23 loc) · 914 Bytes
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
28
29
from selenium import webdriver
import time
import math
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
try:
link = "http://suninjuly.github.io/math.html"
browser = webdriver.Chrome()
browser.get(link)
x = browser.find_element_by_css_selector("#input_value").text
input1 = browser.find_element_by_css_selector("#answer")
input1.send_keys(calc(x))
checkbox = browser.find_element_by_css_selector("#robotCheckbox")
checkbox.click()
radiobutton = browser.find_element_by_css_selector("#robotsRule")
radiobutton.click()
button = browser.find_element_by_css_selector("button.btn")
button.click()
finally:
# ожидание чтобы визуально оценить результаты прохождения скрипта
time.sleep(10)
# закрываем браузер после всех манипуляций
browser.quit()