Releases: seleniumbase/SeleniumBase
Add click_nth_visible_element(selector, number)
Add click_nth_visible_element(selector, number, by=By.CSS_SELECTOR)
Finds all matching page elements and clicks the nth visible one.
Example:
self.click_nth_visible_element('[type="checkbox"]', 5)
### (Clicks the 5th visible checkbox on the page.)Add get_pdf_text() and use that in assert_pdf_text()
Add get_pdf_text() and use that in assert_pdf_text()
-
get_pdf_text(pdf, page=None)
Gets the text from a PDF (The PDF can be either a URL or a path on the local file system. If a Page number is provided, uses that page, otherwise gets everything.) -
assert_pdf_text(pdf, text, page=None)
Asserts that certain text appears in a PDF (The PDF can be either a URL or a path on the local file system. If a Page number is provided, only checks that page, otherwise all pages get scanned for the expected text.)
Create the downloads_folder for PDF-testing use
Create the downloads_folder for PDF-testing use
- When verifying text in a PDF that’s on the web, SeleniumBase will first download it to the
downloads_folder. From there, it's easier to scan with Python for verification. - Continuation of v1.33.2 -> Add the
assert_pdf_text()method for asserting text in a PDF file
Add methods for handling cookies on web pages
Add methods for handling cookies on web pages
self.save_cookies(name="cookies.txt")
self.load_cookies(name="cookies.txt")
self.delete_all_cookies()
self.delete_saved_cookies(name="cookies.txt")(Cookies get saved to the "./saved_cookies/" folder.)
Add assert_pdf_text() method for asserting PDF text
Add the assert_pdf_text() method for asserting text in a PDF file
Refactor and minify Messenger CSS resources
Refactor and minify Messenger CSS resources
- Refactor and minify Messenger resources
- Add a double_click() test
- Update "pytest" and "parameterized" dependencies
Add the inspect_html() method
Add the inspect_html() method
This uses https://cdnjs.com/libraries/html-inspector
and https://github.com/philipwalton/html-inspector
Sample code:
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_html_inspector(self):
self.open("https://xkcd.com/1144/")
self.inspect_html()Run command:
pytest test_inspect_html.pySample output:
* HTML Inspection Results: https://xkcd.com/1144/
X - https://xkcd.com/usNews - Failed to load resource: the server responded with a status of 404 (Not Found)
X - 'property' is not a valid attribute of the <meta> element.
X - Do not use <div> or <span> elements without any attributes.
X - The 'alt' attribute is required for <img> elements.
X - The 'border' attribute is no longer valid on the <img> element and should not be used.
X - 'srcset' is not a valid attribute of the <img> element.
X - The <center> element is obsolete and should not be used.
X - <script> elements should appear right before the closing </body> tag for optimal performance.
X - The id 'comicLinks' appears more than once in the document.
* (See the Console output for details!)
Update pytest, portalocker, and improve error-handling
Update pytest, portalocker, and improve error-handling
- Update
pytest - Update
portalocker - Allow the
update_text()method to handle ints and floats as text - Improve some error messages if/when they occur
Update methods
Update methods
- Add the save_page_source(file_name) method
- Update tqdm dependency to >= 4.38.0
Add "Slow Mode"
Add "Slow Mode"
- Add "Slow Mode". Usage:
--slow - Upgrade the "six" dependency to ">=1.13.0"
Slow Mode is similar to Demo Mode, except that SeleniumBase skips highlighting the elements being interacted with.