MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / _escape_string

Method _escape_string

py/selenium/webdriver/support/select.py:235–248  ·  view source on GitHub ↗
(self, value: str)

Source from the content-addressed store, hash-verified

233 option.click()
234
235 def _escape_string(self, value: str) -> str:
236 if '"' in value and "'" in value:
237 parts = []
238 for index, substring in enumerate(value.split('"')):
239 if index:
240 parts.append("'\"'")
241 if substring:
242 parts.append(f'"{substring}"')
243 return f"concat({', '.join(parts)})"
244
245 if '"' in value:
246 return f"'{value}'"
247
248 return f'"{value}"'
249
250 def _get_longest_token(self, value: str) -> str:
251 items = value.split(" ")

Callers 4

select_by_valueMethod · 0.95
deselect_by_valueMethod · 0.95

Calls 2

splitMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected