@@ -74,9 +74,7 @@ def __init__(self, parent, id_):
74
74
self ._id = id_
75
75
76
76
def __repr__ (self ):
77
- return '<{0.__module__}.{0.__name__} (session="{1}", element="{2}")>' .format (
78
- type (self ), self ._parent .session_id , self ._id
79
- )
77
+ return f'<{ type (self ).__module__ } .{ type (self ).__name__ } (session="{ self ._parent .session_id } ", element="{ self ._id } ")>'
80
78
81
79
@property
82
80
def tag_name (self ) -> str :
@@ -176,9 +174,7 @@ def get_attribute(self, name) -> str:
176
174
"""
177
175
if getAttribute_js is None :
178
176
_load_js ()
179
- attribute_value = self .parent .execute_script (
180
- "return (%s).apply(null, arguments);" % getAttribute_js , self , name
181
- )
177
+ attribute_value = self .parent .execute_script (f"return ({ getAttribute_js } ).apply(null, arguments);" , self , name )
182
178
return attribute_value
183
179
184
180
def is_selected (self ) -> bool :
@@ -261,7 +257,7 @@ def is_displayed(self) -> bool:
261
257
# Only go into this conditional for browsers that don't use the atom themselves
262
258
if isDisplayed_js is None :
263
259
_load_js ()
264
- return self .parent .execute_script ("return (%s ).apply(null, arguments);" % isDisplayed_js , self )
260
+ return self .parent .execute_script (f "return ({ isDisplayed_js } ).apply(null, arguments);" , self )
265
261
266
262
@property
267
263
def location_once_scrolled_into_view (self ) -> dict :
@@ -422,13 +418,13 @@ def find_element(self, by=By.ID, value=None) -> WebElement:
422
418
"""
423
419
if by == By .ID :
424
420
by = By .CSS_SELECTOR
425
- value = '[id="%s "]' % value
421
+ value = f '[id="{ value } "]'
426
422
elif by == By .CLASS_NAME :
427
423
by = By .CSS_SELECTOR
428
- value = ".%s" % value
424
+ value = f". { value } "
429
425
elif by == By .NAME :
430
426
by = By .CSS_SELECTOR
431
- value = '[name="%s "]' % value
427
+ value = f '[name="{ value } "]'
432
428
433
429
return self ._execute (Command .FIND_CHILD_ELEMENT , {"using" : by , "value" : value })["value" ]
434
430
0 commit comments