1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616from collections import namedtuple
17- from typing import List , Optional
17+ from typing import List , Optional , Tuple
1818
1919from robot .utils import plural_or_not
2020from selenium .webdriver .common .action_chains import ActionChains
@@ -51,7 +51,11 @@ def get_webelements(self, locator: str) -> List[WebElement]:
5151
5252 @keyword
5353 def element_should_contain (
54- self , locator : str , expected : str , message : Optional [str ] = None , ignore_case : bool = False
54+ self ,
55+ locator : str ,
56+ expected : str ,
57+ message : Optional [str ] = None ,
58+ ignore_case : bool = False ,
5559 ):
5660 """Verifies that element ``locator`` contains text ``expected``.
5761
@@ -85,7 +89,11 @@ def element_should_contain(
8589
8690 @keyword
8791 def element_should_not_contain (
88- self , locator : str , expected : str , message : Optional [str ] = None , ignore_case : bool = False
92+ self ,
93+ locator : str ,
94+ expected : str ,
95+ message : Optional [str ] = None ,
96+ ignore_case : bool = False ,
8997 ):
9098 """Verifies that element ``locator`` does not contain text ``expected``.
9199
@@ -133,7 +141,11 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"):
133141
134142 @keyword
135143 def page_should_contain_element (
136- self , locator : str , message : Optional [str ] = None , loglevel : Optional [str ] = "TRACE" , limit : Optional [int ] = None
144+ self ,
145+ locator : str ,
146+ message : Optional [str ] = None ,
147+ loglevel : Optional [str ] = "TRACE" ,
148+ limit : Optional [int ] = None ,
137149 ):
138150 """Verifies that element ``locator`` is found on the current page.
139151
@@ -189,7 +201,9 @@ def page_should_not_contain(self, text: str, loglevel: str = "TRACE"):
189201 self .info (f"Current page does not contain text '{ text } '." )
190202
191203 @keyword
192- def page_should_not_contain_element (self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE" ):
204+ def page_should_not_contain_element (
205+ self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE"
206+ ):
193207 """Verifies that element ``locator`` is not found on the current page.
194208
195209 See the `Locating elements` section for details about the locator
@@ -284,7 +298,9 @@ def element_should_be_visible(self, locator: str, message: Optional[str] = None)
284298 self .info (f"Element '{ locator } ' is displayed." )
285299
286300 @keyword
287- def element_should_not_be_visible (self , locator : str , message : Optional [str ] = None ):
301+ def element_should_not_be_visible (
302+ self , locator : str , message : Optional [str ] = None
303+ ):
288304 """Verifies that the element identified by ``locator`` is NOT visible.
289305
290306 Passes if the element does not exists. See `Element Should Be Visible`
@@ -302,7 +318,11 @@ def element_should_not_be_visible(self, locator: str, message: Optional[str] = N
302318
303319 @keyword
304320 def element_text_should_be (
305- self , locator : str , expected : str , message : Optional [str ] = None , ignore_case : bool = False
321+ self ,
322+ locator : str ,
323+ expected : str ,
324+ message : Optional [str ] = None ,
325+ ignore_case : bool = False ,
306326 ):
307327 """Verifies that element ``locator`` contains exact the text ``expected``.
308328
@@ -334,7 +354,11 @@ def element_text_should_be(
334354
335355 @keyword
336356 def element_text_should_not_be (
337- self , locator : str , not_expected : str , message : Optional [str ] = None , ignore_case : bool = False
357+ self ,
358+ locator : str ,
359+ not_expected : str ,
360+ message : Optional [str ] = None ,
361+ ignore_case : bool = False ,
338362 ):
339363 """Verifies that element ``locator`` does not contain exact the text ``not_expected``.
340364
@@ -419,7 +443,7 @@ def get_horizontal_position(self, locator: str) -> int:
419443 return self .find_element (locator ).location ["x" ]
420444
421445 @keyword
422- def get_element_size (self , locator : str ) -> int :
446+ def get_element_size (self , locator : str ) -> Tuple [ int , int ] :
423447 """Returns width and height of the element identified by ``locator``.
424448
425449 See the `Locating elements` section for details about the locator
@@ -571,7 +595,9 @@ def click_link(self, locator: str, modifier: Optional[str] = False):
571595 self ._click_with_modifier (locator , ["link" , "link" ], modifier )
572596
573597 @keyword
574- def click_element (self , locator : str , modifier : Optional [str ] = False , action_chain : bool = False ):
598+ def click_element (
599+ self , locator : str , modifier : Optional [str ] = False , action_chain : bool = False
600+ ):
575601 """Click the element identified by ``locator``.
576602
577603 See the `Locating elements` section for details about the locator
@@ -953,7 +979,9 @@ def mouse_down_on_link(self, locator: str):
953979 action .click_and_hold (element ).perform ()
954980
955981 @keyword
956- def page_should_contain_link (self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE" ):
982+ def page_should_contain_link (
983+ self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE"
984+ ):
957985 """Verifies link identified by ``locator`` is found from current page.
958986
959987 See the `Locating elements` section for details about the locator
@@ -966,7 +994,9 @@ def page_should_contain_link(self, locator: str, message: Optional[str] = None,
966994 self .assert_page_contains (locator , "link" , message , loglevel )
967995
968996 @keyword
969- def page_should_not_contain_link (self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE" ):
997+ def page_should_not_contain_link (
998+ self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE"
999+ ):
9701000 """Verifies link identified by ``locator`` is not found from current page.
9711001
9721002 See the `Locating elements` section for details about the locator
@@ -991,7 +1021,9 @@ def mouse_down_on_image(self, locator: str):
9911021 action .click_and_hold (element ).perform ()
9921022
9931023 @keyword
994- def page_should_contain_image (self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE" ):
1024+ def page_should_contain_image (
1025+ self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE"
1026+ ):
9951027 """Verifies image identified by ``locator`` is found from current page.
9961028
9971029 See the `Locating elements` section for details about the locator
@@ -1004,7 +1036,9 @@ def page_should_contain_image(self, locator: str, message: Optional[str] = None,
10041036 self .assert_page_contains (locator , "image" , message , loglevel )
10051037
10061038 @keyword
1007- def page_should_not_contain_image (self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE" ):
1039+ def page_should_not_contain_image (
1040+ self , locator : str , message : Optional [str ] = None , loglevel : str = "TRACE"
1041+ ):
10081042 """Verifies image identified by ``locator`` is not found from current page.
10091043
10101044 See the `Locating elements` section for details about the locator
@@ -1033,7 +1067,9 @@ def get_element_count(self, locator: str) -> int:
10331067 return len (self .find_elements (locator ))
10341068
10351069 @keyword
1036- def add_location_strategy (self , strategy_name : str , strategy_keyword : str , persist : bool = False ):
1070+ def add_location_strategy (
1071+ self , strategy_name : str , strategy_keyword : str , persist : bool = False
1072+ ):
10371073 """Adds a custom location strategy.
10381074
10391075 See `Custom locators` for information on how to create and use
0 commit comments