-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize and document ensure_element method of Session (#75)
* ensure_element documentation updates * internal use of up-to-date locator strategy names * backwards compatibility for underscored locator strategies * test to ensure deprecation warning is raised for old strategy names * update requirements.txt to match poetry
- Loading branch information
Showing
5 changed files
with
84 additions
and
39 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
parsel>=1.7.0 | ||
requests>=2.28.1 | ||
selenium>=4.6.0 | ||
tldextract>=3.4.0 | ||
parsel>=1.8.1 | ||
requests>=2.31.0 | ||
selenium>=4.15.2 | ||
tldextract>=5.1.1 |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import shutil | ||
|
||
import pytest | ||
import selenium | ||
from selenium.webdriver.common.by import By | ||
|
||
import requestium | ||
|
||
chrome_webdriver_path = shutil.which('chromedriver') | ||
|
||
chrome_webdriver = selenium.webdriver.chrome.webdriver.WebDriver() | ||
firefox_webdriver = selenium.webdriver.firefox.webdriver.WebDriver() | ||
|
||
session_parameters = [ | ||
{'webdriver_path': chrome_webdriver_path}, | ||
{'webdriver_path': chrome_webdriver_path, 'headless': True}, | ||
{'driver': chrome_webdriver}, | ||
{'driver': firefox_webdriver}, | ||
] | ||
|
||
|
||
@pytest.fixture(params=session_parameters) | ||
def session(request): | ||
session = requestium.Session(**request.param) | ||
yield session | ||
session.driver.close() | ||
|
||
|
||
def test_deprecation_warning_for_ensure_element_locators_with_underscores(session): | ||
session.driver.get('http://the-internet.herokuapp.com') | ||
with pytest.warns(DeprecationWarning): | ||
session.driver.ensure_element("class_name", 'no-js') |
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