@@ -224,7 +224,7 @@ def page_should_not_contain_element(
224224 self .assert_page_not_contains (locator , message = message , loglevel = loglevel )
225225
226226 @keyword
227- def assign_id_to_element (self , locator : Locator , id : str ): # noqa: A002
227+ def assign_id_to_element (self , locator : Locator , id : str ): # noqa: A002
228228 """Assigns a temporary ``id`` to the element specified by ``locator``.
229229
230230 This is mainly useful if the locator is complicated and/or slow XPath
@@ -286,9 +286,7 @@ def element_should_be_focused(self, locator: Locator):
286286 raise AssertionError (f"Element '{ locator } ' does not have focus." )
287287
288288 @keyword
289- def element_should_be_visible (
290- self , locator : Locator , message : str | None = None
291- ):
289+ def element_should_be_visible (self , locator : Locator , message : str | None = None ):
292290 """Verifies that the element identified by ``locator`` is visible.
293291
294292 Herein, visible means that the element is logically visible, not
@@ -398,9 +396,7 @@ def element_text_should_not_be(
398396 raise AssertionError (message )
399397
400398 @keyword
401- def get_element_attribute (
402- self , locator : Locator , attribute : str
403- ) -> str :
399+ def get_element_attribute (self , locator : Locator , attribute : str ) -> str :
404400 """Returns the value of ``attribute`` from the element ``locator``.
405401
406402 See the `Locating elements` section for details about the locator
@@ -416,9 +412,7 @@ def get_element_attribute(
416412 return self .find_element (locator ).get_attribute (attribute )
417413
418414 @keyword
419- def get_dom_attribute (
420- self , locator : Locator , attribute : str
421- ) -> str :
415+ def get_dom_attribute (self , locator : Locator , attribute : str ) -> str :
422416 """Returns the value of ``attribute`` from the element ``locator``. `Get DOM Attribute` keyword
423417 only returns attributes declared within the element's HTML markup. If the requested attribute
424418 is not there, the keyword returns ${None}.
@@ -434,7 +428,9 @@ def get_dom_attribute(
434428
435429 @keyword
436430 def get_property (
437- self , locator : Locator , property : str # noqa: A002
431+ self ,
432+ locator : Locator ,
433+ property : str , # noqa: A002
438434 ) -> str :
439435 """Returns the value of ``property`` from the element ``locator``.
440436
@@ -581,9 +577,7 @@ def get_vertical_position(self, locator: Locator) -> int:
581577 return self .find_element (locator ).location ["y" ]
582578
583579 @keyword
584- def click_button (
585- self , locator : Locator , modifier : bool | str = False
586- ):
580+ def click_button (self , locator : Locator , modifier : bool | str = False ):
587581 """Clicks the button identified by ``locator``.
588582
589583 See the `Locating elements` section for details about the locator
@@ -605,9 +599,7 @@ def click_button(
605599 self ._click_with_modifier (locator , ["button" , "input" ], modifier )
606600
607601 @keyword
608- def click_image (
609- self , locator : Locator , modifier : bool | str = False
610- ):
602+ def click_image (self , locator : Locator , modifier : bool | str = False ):
611603 """Clicks an image identified by ``locator``.
612604
613605 See the `Locating elements` section for details about the locator
@@ -630,9 +622,7 @@ def click_image(
630622 self ._click_with_modifier (locator , ["image" , "input" ], modifier )
631623
632624 @keyword
633- def click_link (
634- self , locator : Locator , modifier : bool | str = False
635- ):
625+ def click_link (self , locator : Locator , modifier : bool | str = False ):
636626 """Clicks a link identified by ``locator``.
637627
638628 See the `Locating elements` section for details about the locator
@@ -774,12 +764,12 @@ def scroll_element_into_view(self, locator: Locator):
774764 New in SeleniumLibrary 3.2.0
775765 """
776766 element = self .find_element (locator )
777- ActionChains (self .driver , duration = self .ctx .action_chain_delay ).move_to_element (element ).perform ()
767+ ActionChains (self .driver , duration = self .ctx .action_chain_delay ).move_to_element (
768+ element
769+ ).perform ()
778770
779771 @keyword
780- def drag_and_drop (
781- self , locator : Locator , target : Locator
782- ):
772+ def drag_and_drop (self , locator : Locator , target : Locator ):
783773 """Drags the element identified by ``locator`` into the ``target`` element.
784774
785775 The ``locator`` argument is the locator of the dragged element
@@ -795,9 +785,7 @@ def drag_and_drop(
795785 action .drag_and_drop (element , target ).perform ()
796786
797787 @keyword
798- def drag_and_drop_by_offset (
799- self , locator : Locator , xoffset : int , yoffset : int
800- ):
788+ def drag_and_drop_by_offset (self , locator : Locator , xoffset : int , yoffset : int ):
801789 """Drags the element identified with ``locator`` by ``xoffset/yoffset``.
802790
803791 See the `Locating elements` section for details about the locator
@@ -869,7 +857,9 @@ def mouse_up(self, locator: Locator):
869857 """
870858 self .info (f"Simulating Mouse Up on element '{ locator } '." )
871859 element = self .find_element (locator )
872- ActionChains (self .driver , duration = self .ctx .action_chain_delay ).release (element ).perform ()
860+ ActionChains (self .driver , duration = self .ctx .action_chain_delay ).release (
861+ element
862+ ).perform ()
873863
874864 @keyword
875865 def open_context_menu (self , locator : Locator ):
@@ -988,7 +978,9 @@ def press_keys(self, locator: Locator | None = None, *keys: str):
988978 if not is_noney (locator ):
989979 self .info (f"Sending key(s) { keys } to { locator } element." )
990980 element = self .find_element (locator )
991- ActionChains (self .driver , duration = self .ctx .action_chain_delay ).click (element ).perform ()
981+ ActionChains (self .driver , duration = self .ctx .action_chain_delay ).click (
982+ element
983+ ).perform ()
992984 else :
993985 self .info (f"Sending key(s) { keys } to page." )
994986 element = None
@@ -1228,7 +1220,9 @@ def parse_modifier(self, modifier):
12281220 if hasattr (Keys , modifier ):
12291221 keys .append (getattr (Keys , modifier ))
12301222 else :
1231- raise ValueError (f"'{ modifier } ' modifier does not match to Selenium Keys" )
1223+ raise ValueError (
1224+ f"'{ modifier } ' modifier does not match to Selenium Keys"
1225+ )
12321226 return keys
12331227
12341228 def _parse_keys (self , * keys ):
@@ -1271,18 +1265,20 @@ def _convert_special_keys(self, keys):
12711265 for key in keys :
12721266 resolved_key = self ._parse_aliases (key )
12731267 if self ._selenium_keys_has_attr (resolved_key ):
1274- converted_keys .append (self .KeysRecord (getattr (Keys , resolved_key ), resolved_key , True ))
1268+ converted_keys .append (
1269+ self .KeysRecord (getattr (Keys , resolved_key ), resolved_key , True )
1270+ )
12751271 else :
1276- converted_keys .append (self .KeysRecord (resolved_key , resolved_key , False ))
1272+ converted_keys .append (
1273+ self .KeysRecord (resolved_key , resolved_key , False )
1274+ )
12771275 return converted_keys
12781276
12791277 def _selenium_keys_has_attr (self , key ):
12801278 return hasattr (Keys , key )
12811279
12821280 @keyword ("Get CSS Property Value" )
1283- def get_css_property_value (
1284- self , locator : Locator , css_property : str
1285- ) -> str :
1281+ def get_css_property_value (self , locator : Locator , css_property : str ) -> str :
12861282 """Returns the computed value of ``css_property`` from the element ``locator``.
12871283
12881284 See the `Locating elements` section for details about the locator syntax.
0 commit comments