Skip to content

Commit b869b99

Browse files
committed
[py] add name of what is being executed to large JS executions
1 parent 3e9d64d commit b869b99

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

py/selenium/webdriver/remote/webdriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def find_elements(self, by=By.ID, value: Optional[str] = None) -> List[WebElemen
842842
if isinstance(by, RelativeBy):
843843
_pkg = ".".join(__name__.split(".")[:-1])
844844
raw_function = pkgutil.get_data(_pkg, "findElements.js").decode("utf8")
845-
find_element_js = f"return ({raw_function}).apply(null, arguments);"
845+
find_element_js = f"/* findElements */return ({raw_function}).apply(null, arguments);"
846846
return self.execute_script(find_element_js, by.to_dict())
847847

848848
if by == By.ID:

py/selenium/webdriver/remote/webelement.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def click(self) -> None:
9595
def submit(self):
9696
"""Submits a form."""
9797
script = (
98-
"var form = arguments[0];\n"
98+
"/* submitForm */var form = arguments[0];\n"
9999
'while (form.nodeName != "FORM" && form.parentNode) {\n'
100100
" form = form.parentNode;\n"
101101
"}\n"
@@ -174,7 +174,9 @@ def get_attribute(self, name) -> str:
174174
"""
175175
if getAttribute_js is None:
176176
_load_js()
177-
attribute_value = self.parent.execute_script(f"return ({getAttribute_js}).apply(null, arguments);", self, name)
177+
attribute_value = self.parent.execute_script(
178+
f"/* getAttribute */return ({getAttribute_js}).apply(null, arguments);", self, name
179+
)
178180
return attribute_value
179181

180182
def is_selected(self) -> bool:
@@ -255,7 +257,7 @@ def is_displayed(self) -> bool:
255257
# Only go into this conditional for browsers that don't use the atom themselves
256258
if isDisplayed_js is None:
257259
_load_js()
258-
return self.parent.execute_script(f"return ({isDisplayed_js}).apply(null, arguments);", self)
260+
return self.parent.execute_script(f"/* isDisplayed */return ({isDisplayed_js}).apply(null, arguments);", self)
259261

260262
@property
261263
def location_once_scrolled_into_view(self) -> dict:

0 commit comments

Comments
 (0)