11from s_tool .driver import SeleniumDriver
2- from s_tool .parser import select_options
2+ from s_tool .parser import get_table , select_options
33
44from . import TEST_URL
55
@@ -10,16 +10,16 @@ def test_select():
1010 obj .get (TEST_URL )
1111
1212 # Test dropdown options with element id
13- options_dicts = select_options (obj .element ("id" , " sel1" ))
13+ options_dicts = select_options (obj .element ("sel1" ))
1414 actual_result = {"1" : "1" , "2" : "2" , "3" : "3" , "4" : "4" }
1515 assert options_dicts == actual_result
1616
1717 # Test for invalid element
18- options_dicts = select_options (obj .element ("id " , "select_id " ))
18+ options_dicts = select_options (obj .element ("select_id " , "id " ))
1919 assert options_dicts == {}
2020
2121 # Test for disabled dropdown
22- options_dicts = select_options (obj .element ("xpath" , '//select[@disabled=""]' ))
22+ options_dicts = select_options (obj .element ('//select[@disabled=""]' , "xpath" ))
2323 assert options_dicts == {
2424 "default" : "default" ,
2525 "1" : "One" ,
@@ -28,11 +28,19 @@ def test_select():
2828 }
2929
3030 # Test for swaping keys and values\
31- elem = obj .element ("xpath" , '//select[@disabled=""]' )
31+ elem = obj .element ('//select[@disabled=""]' , "xpath" )
3232 options_dicts = select_options (elem , swap = True )
3333 assert options_dicts == {
3434 "default" : "default" ,
3535 "One" : "1" ,
3636 "Two" : "2" ,
3737 "Three" : "3" ,
3838 }
39+
40+
41+ def test_table ():
42+ with SeleniumDriver ("chrome" , headless = True ) as obj :
43+ obj .get (TEST_URL )
44+ table = obj .element ('//table[@class="table"]' , "xpath" )
45+ table_data = get_table (table )
46+ assert len (table_data ) == 4
0 commit comments