MCPcopy Index your code
hub / github.com/pyscript/pyscript / test_find_item_by_class

Function test_find_item_by_class

core/tests/python/tests/test_web.py:37–52  ·  view source on GitHub ↗

Elements with a given class in the DOM can be retrieved by class via the find method.

()

Source from the content-addressed store, hash-verified

35
36
37def test_find_item_by_class():
38 """
39 Elements with a given class in the DOM can be retrieved by class via the
40 find method.
41 """
42 ids = [
43 "test_class_selector",
44 "test_selector_w_children",
45 "test_selector_w_children_child_1",
46 ]
47 expected_class = "a-test-class"
48 result = web.page.find(f".{expected_class}")
49 # EXPECT to find exact number of elements with the class in the page (== 3)
50 assert len(result) == 3
51 # EXPECT that all element ids are in the expected list
52 assert [el.id for el in result] == ids
53
54
55def test_read_n_write_collection_elements():

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected