@@ -25,6 +25,70 @@ def __setup():
2525 synchronous .close_session (driver_url , session )
2626
2727
28+ @mark .asyncio
29+ async def test_set_timeouts (__setup ):
30+ driver_url , session = __setup
31+ timeouts_1 = 5000 # milliseconds
32+ timeouts_2 = 3000 # milliseconds
33+
34+ synchronous .set_timeouts (driver_url , session , timeouts_1 )
35+
36+ assert synchronous .get_timeouts (driver_url , session ).get ("implicit" ) == timeouts_1
37+
38+ await asynchronous .set_timeouts (driver_url , session , timeouts_2 )
39+
40+ assert synchronous .get_timeouts (driver_url , session ).get ("implicit" ) == timeouts_2
41+
42+
43+ @mark .asyncio
44+ async def test_find_children_elements (__setup ):
45+ driver_url , session = __setup
46+ expected = 5 # parent inclusive
47+ locator_type = "xpath"
48+ locator_value = "//div"
49+
50+ parent_element = synchronous .find_element (
51+ driver_url , session , locator_type , '//div[@class="parent"]'
52+ )
53+
54+ children_elements = synchronous .find_children_elements (
55+ driver_url , session , parent_element , locator_type , locator_value
56+ )
57+
58+ assert len (children_elements ) == expected
59+
60+ children_elements = await asynchronous .find_children_elements (
61+ driver_url , session , parent_element , locator_type , locator_value
62+ )
63+
64+ assert len (children_elements ) == expected
65+
66+
67+ @mark .asyncio
68+ async def test_find_child_element (__setup ):
69+ driver_url , session = __setup
70+ expected = "any4"
71+ locator_type = "xpath"
72+ locator_value = '//div[@class="child4"]'
73+
74+ parent_element = synchronous .find_element (
75+ driver_url , session , locator_type , '//div[@class="parent"]'
76+ )
77+
78+ child_element = synchronous .find_child_element (
79+ driver_url , session , parent_element , locator_type , locator_value
80+ )
81+
82+ text = synchronous .get_text (driver_url , session , child_element )
83+
84+ assert text == expected
85+ child_element = await asynchronous .find_child_element (
86+ driver_url , session , parent_element , locator_type , locator_value
87+ )
88+ text = synchronous .get_text (driver_url , session , child_element )
89+ assert text == expected
90+
91+
2892@mark .asyncio
2993async def test_get_page_source (__setup ):
3094 driver_url , session = __setup
0 commit comments