-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into csharp-selenium-manager-example
- Loading branch information
Showing
10 changed files
with
220 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
selenium==4.27.1 | ||
pytest | ||
trio | ||
pytest-trio | ||
pytest-rerunfailures | ||
flake8 | ||
requests | ||
pytest==8.3.4 | ||
trio==0.27.0 | ||
pytest-trio==0.8.0 | ||
pytest-rerunfailures==14.0 | ||
flake8==7.1.1 | ||
requests==2.32.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,84 @@ | ||
import pytest | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
|
||
|
||
def test_class_name(): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.CLASS_NAME, "information") | ||
|
||
assert element is not None | ||
assert element.tag_name == "input" | ||
|
||
driver.quit() | ||
|
||
def test_css_selector(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.CSS_SELECTOR, "#fname") | ||
|
||
assert element is not None | ||
assert element.get_attribute("value") == "Jane" | ||
|
||
driver.quit() | ||
|
||
def test_id(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.ID, "lname") | ||
|
||
assert element is not None | ||
assert element.get_attribute("value") == "Doe" | ||
|
||
driver.quit() | ||
|
||
def test_name(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.NAME, "newsletter") | ||
|
||
assert element is not None | ||
assert element.tag_name == "input" | ||
|
||
driver.quit() | ||
|
||
def test_link_text(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.LINK_TEXT, "Selenium Official Page") | ||
|
||
assert element is not None | ||
assert element.get_attribute("href") == "https://www.selenium.dev/" | ||
|
||
driver.quit() | ||
|
||
def test_partial_link_text(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.PARTIAL_LINK_TEXT, "Official Page") | ||
|
||
assert element is not None | ||
assert element.get_attribute("href") == "https://www.selenium.dev/" | ||
|
||
driver.quit() | ||
|
||
def test_tag_name(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.TAG_NAME, "a") | ||
|
||
assert element is not None | ||
assert element.get_attribute("href") == "https://www.selenium.dev/" | ||
|
||
driver.quit() | ||
|
||
def test_xpath(driver): | ||
driver = webdriver.Chrome() | ||
driver.get("https://www.selenium.dev/selenium/web/locators_tests/locators.html") | ||
element = driver.find_element(By.XPATH, "//input[@value='f']") | ||
|
||
assert element is not None | ||
assert element.get_attribute("type") == "radio" | ||
|
||
driver.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.