-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.3.3.py
35 lines (23 loc) · 795 Bytes
/
2.3.3.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
28
29
30
31
32
33
34
35
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import math
link = "http://suninjuly.github.io/redirect_accept.html"
browser = webdriver.Chrome()
browser.get(link)
browser.execute_script("window.scrollBy(0, 100);")
button = browser.find_element(By.CSS_SELECTOR, "[type = 'submit']")
button.click()
new_window = browser.window_handles[1]
browser.switch_to.window(new_window)
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
x_element = browser.find_element(By.CSS_SELECTOR, "[id = 'input_value']")
x = x_element.text
y = calc(x)
input1 = browser.find_element(By.CSS_SELECTOR, "[id = 'answer']")
input1.send_keys(y)
button = browser.find_element(By.CSS_SELECTOR, "[type = 'submit']")
button.click()
time.sleep(30)
browser.quit()