Skip to content

Add methods for asserting multiple elements with just one line of code #858

@mdmintz

Description

@mdmintz

Add methods for asserting multiple elements with just one line of code.

Asserting HTML Presence: assert_elements_present()
Asserting HTML Visibility: assert_elements() <> assert_elements_visible()

The input should be either a list of (CSS) Selectors, or multiple args where each one is a (CSS) Selector. Also include optional kwargs for changing the default timeout value, or for changing the by, which will impact all the items in the list.

In keeping the format of existing methods, assert_elements_visible() should just be a duplicate method name for assert_elements() to avoid possible confusion. There is a distinction to be made between visible elements (eg. h1, h2, etc) and elements that are present (eg. head, style, etc), which include both visible and hidden elements on a web page.

For the methods that assert visibility (assert_elements_visible() and assert_elements()) Demo Mode (--demo) is expected to function correctly as it does for other methods that assert element visibility.

Expected examples that should work when this task is completed:

self.assert_elements_present("head", "style", "script")
self.assert_elements("h1", "h2", "h3")
self.assert_elements(["h1", "h2", "h3"])
self.assert_elements("h1", "h2", "h3", timeout=1)
self.assert_elements(["h1", "h2", "h3"], timeout=1)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions