-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_selenium.py
36 lines (23 loc) · 1.01 KB
/
test_selenium.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
#
# browser = webdriver.chrome('/Users/admin/Documents/GitHub/ftp_downloader/Drivers/chromedriver')
# browser.get('http://selenium.dev/')
from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service as ChromeService
def test_eight_components():
driver = webdriver.Chrome(service=ChromeService(executable_path=ChromeDriverManager().install()))
driver.get("https://duckduckgo.com/")
title = driver.title
assert "DuckDuckGo" in title
driver.implicitly_wait(10)
search_box = driver.find_element(by=By.NAME, value="q")
search_button = driver.find_element(by=By.ID, value="search_button_homepage")
search_box.send_keys("Selenium")
search_button.click()
search_box = driver.find_element(by=By.NAME, value="q")
value = search_box.get_attribute("value")
assert value == "Selenium"
driver.quit()
test_eight_components()