-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselenium_ex
More file actions
31 lines (24 loc) · 1.12 KB
/
selenium_ex
File metadata and controls
31 lines (24 loc) · 1.12 KB
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
from selenium import webdriver
# Set up the webdriver and navigate to the login page
driver = webdriver.Chrome()
driver.get('https://example.com/login')
# Find the login form and enter the username and password
username_input = driver.find_element_by_html_attribute('input[name="username"]')
username_input.send_keys('your_username')
password_input = driver.find_element_by_html_attribute('input[name="password"]')
password_input.send_keys('your_password')
# Find the login button and click it
login_button = driver.find_element_by_html_attribute('button[type="submit"]')
login_button.click()
# Wait for the login process to complete and navigate to the desired page
driver.implicitly_wait(10) # wait for up to 10 seconds for the page to load
driver.get('https://example.com/desired_page')
# Find the button and click it
button = driver.find_element_by_html_attribute('button')
button.click()
# Find the form and enter text in it
form = driver.find_element_by_html_attribute('form')
form.send_keys('Hi Mark')
# Find the submit button and click it
submit_button = driver.find_element_by_title('сохранить')
submit_button.click()