1515# limitations under the License.
1616
1717import os
18- from typing import Optional , Union
18+ from typing import Optional , Union , List
1919
2020from robot .libraries .BuiltIn import BuiltIn
2121from selenium .webdriver .remote .webelement import WebElement
2626
2727class FormElementKeywords (LibraryComponent ):
2828 @keyword
29- def submit_form (self , locator : Union [WebElement , None , str ] = None ):
29+ def submit_form (self , locator : Union [WebElement , None , str , List [ Union [ WebElement , str ]] ] = None ):
3030 """Submits a form identified by ``locator``.
3131
3232 If ``locator`` is not given, first form on the page is submitted.
@@ -41,7 +41,7 @@ def submit_form(self, locator: Union[WebElement, None, str] = None):
4141 element .submit ()
4242
4343 @keyword
44- def checkbox_should_be_selected (self , locator : Union [WebElement , str ]):
44+ def checkbox_should_be_selected (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ]):
4545 """Verifies checkbox ``locator`` is selected/checked.
4646
4747 See the `Locating elements` section for details about the locator
@@ -55,7 +55,7 @@ def checkbox_should_be_selected(self, locator: Union[WebElement, str]):
5555 )
5656
5757 @keyword
58- def checkbox_should_not_be_selected (self , locator : Union [WebElement , str ]):
58+ def checkbox_should_not_be_selected (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ]):
5959 """Verifies checkbox ``locator`` is not selected/checked.
6060
6161 See the `Locating elements` section for details about the locator
@@ -69,7 +69,7 @@ def checkbox_should_not_be_selected(self, locator: Union[WebElement, str]):
6969 @keyword
7070 def page_should_contain_checkbox (
7171 self ,
72- locator : Union [WebElement , str ],
72+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
7373 message : Optional [str ] = None ,
7474 loglevel : str = "TRACE" ,
7575 ):
@@ -86,7 +86,7 @@ def page_should_contain_checkbox(
8686 @keyword
8787 def page_should_not_contain_checkbox (
8888 self ,
89- locator : Union [WebElement , str ],
89+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
9090 message : Optional [str ] = None ,
9191 loglevel : str = "TRACE" ,
9292 ):
@@ -101,7 +101,7 @@ def page_should_not_contain_checkbox(
101101 self .assert_page_not_contains (locator , "checkbox" , message , loglevel )
102102
103103 @keyword
104- def select_checkbox (self , locator : Union [WebElement , str ]):
104+ def select_checkbox (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ]):
105105 """Selects the checkbox identified by ``locator``.
106106
107107 Does nothing if checkbox is already selected.
@@ -115,7 +115,7 @@ def select_checkbox(self, locator: Union[WebElement, str]):
115115 element .click ()
116116
117117 @keyword
118- def unselect_checkbox (self , locator : Union [WebElement , str ]):
118+ def unselect_checkbox (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ]):
119119 """Removes the selection of checkbox identified by ``locator``.
120120
121121 Does nothing if the checkbox is not selected.
@@ -131,7 +131,7 @@ def unselect_checkbox(self, locator: Union[WebElement, str]):
131131 @keyword
132132 def page_should_contain_radio_button (
133133 self ,
134- locator : Union [WebElement , str ],
134+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
135135 message : Optional [str ] = None ,
136136 loglevel : str = "TRACE" ,
137137 ):
@@ -149,7 +149,7 @@ def page_should_contain_radio_button(
149149 @keyword
150150 def page_should_not_contain_radio_button (
151151 self ,
152- locator : Union [WebElement , str ],
152+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
153153 message : Optional [str ] = None ,
154154 loglevel : str = "TRACE" ,
155155 ):
@@ -213,7 +213,7 @@ def select_radio_button(self, group_name: str, value: str):
213213 element .click ()
214214
215215 @keyword
216- def choose_file (self , locator : Union [WebElement , str ], file_path : str ):
216+ def choose_file (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ], file_path : str ):
217217 """Inputs the ``file_path`` into the file input field ``locator``.
218218
219219 This keyword is most often used to input files into upload forms.
@@ -240,7 +240,7 @@ def choose_file(self, locator: Union[WebElement, str], file_path: str):
240240
241241 @keyword
242242 def input_password (
243- self , locator : Union [WebElement , str ], password : str , clear : bool = True
243+ self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ], password : str , clear : bool = True
244244 ):
245245 """Types the given password into the text field identified by ``locator``.
246246
@@ -270,7 +270,7 @@ def input_password(
270270
271271 @keyword
272272 def input_text (
273- self , locator : Union [WebElement , str ], text : str , clear : bool = True
273+ self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ], text : str , clear : bool = True
274274 ):
275275 """Types the given ``text`` into the text field identified by ``locator``.
276276
@@ -299,7 +299,7 @@ def input_text(
299299 @keyword
300300 def page_should_contain_textfield (
301301 self ,
302- locator : Union [WebElement , str ],
302+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
303303 message : Optional [str ] = None ,
304304 loglevel : str = "TRACE" ,
305305 ):
@@ -316,7 +316,7 @@ def page_should_contain_textfield(
316316 @keyword
317317 def page_should_not_contain_textfield (
318318 self ,
319- locator : Union [WebElement , str ],
319+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
320320 message : Optional [str ] = None ,
321321 loglevel : str = "TRACE" ,
322322 ):
@@ -333,7 +333,7 @@ def page_should_not_contain_textfield(
333333 @keyword
334334 def textfield_should_contain (
335335 self ,
336- locator : Union [WebElement , str ],
336+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
337337 expected : str ,
338338 message : Optional [str ] = None ,
339339 ):
@@ -357,7 +357,7 @@ def textfield_should_contain(
357357 @keyword
358358 def textfield_value_should_be (
359359 self ,
360- locator : Union [WebElement , str ],
360+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
361361 expected : str ,
362362 message : Optional [str ] = None ,
363363 ):
@@ -381,7 +381,7 @@ def textfield_value_should_be(
381381 @keyword
382382 def textarea_should_contain (
383383 self ,
384- locator : Union [WebElement , str ],
384+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
385385 expected : str ,
386386 message : Optional [str ] = None ,
387387 ):
@@ -405,7 +405,7 @@ def textarea_should_contain(
405405 @keyword
406406 def textarea_value_should_be (
407407 self ,
408- locator : Union [WebElement , str ],
408+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
409409 expected : str ,
410410 message : Optional [str ] = None ,
411411 ):
@@ -429,7 +429,7 @@ def textarea_value_should_be(
429429 @keyword
430430 def page_should_contain_button (
431431 self ,
432- locator : Union [WebElement , str ],
432+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
433433 message : Optional [str ] = None ,
434434 loglevel : str = "TRACE" ,
435435 ):
@@ -450,7 +450,7 @@ def page_should_contain_button(
450450 @keyword
451451 def page_should_not_contain_button (
452452 self ,
453- locator : Union [WebElement , str ],
453+ locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ],
454454 message : Optional [str ] = None ,
455455 loglevel : str = "TRACE" ,
456456 ):
@@ -469,7 +469,7 @@ def page_should_not_contain_button(
469469 def _get_value (self , locator , tag ):
470470 return self .find_element (locator , tag ).get_attribute ("value" )
471471
472- def _get_checkbox (self , locator : Union [WebElement , str ]):
472+ def _get_checkbox (self , locator : Union [WebElement , str , List [ Union [ WebElement , str ]] ]):
473473 return self .find_element (locator , tag = "checkbox" )
474474
475475 def _get_radio_buttons (self , group_name ):
0 commit comments