Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion skyvern/library/skyvern_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def filter(self, **kwargs: Any) -> "SkyvernLocator":

def locator(self, selector: str, **kwargs: Any) -> "SkyvernLocator":
"""Find a descendant element."""
return SkyvernLocator(self._locator.locator(selector, **kwargs))
# Micro-optimization: Avoid unnecessary allocation of kwargs dict if none passed
if not kwargs:
new_locator = self._locator.locator(selector)
else:
new_locator = self._locator.locator(selector, **kwargs)
return SkyvernLocator(new_locator)

def get_by_label(self, text: str | Pattern[str], **kwargs: Any) -> "SkyvernLocator":
"""Find an input element by its associated label text."""
Expand Down