mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix _make_sizzle_string
The github action runs on python 3.7. From the python docs: ``` Changed in version 3.7: Only characters that can have special meaning in a regular expression are escaped. As a result, '!', '"', '%', "'", ',', '/', ':', ';', '<', '=', '>', '@', and "`" are no longer escaped. ```
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Utilities for using sizzle (jQuery-style) selectors with Selenium."""
|
||||
|
||||
import re
|
||||
import json
|
||||
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
@@ -119,11 +119,9 @@ def _is_sizzle_loaded(driver):
|
||||
|
||||
|
||||
def _make_sizzle_string(sizzle_selector):
|
||||
try:
|
||||
selector = sizzle_selector.decode("utf-8")
|
||||
except (AttributeError, UnicodeEncodeError):
|
||||
selector = sizzle_selector
|
||||
return "return Sizzle(\"{selector}\");".format(selector=re.escape(selector))
|
||||
# Use json.dumps to escape quotes
|
||||
selector = json.dumps(sizzle_selector)
|
||||
return f"return Sizzle({selector});"
|
||||
|
||||
|
||||
__all__ = (
|
||||
|
||||
Reference in New Issue
Block a user