diff --git a/src/Selenium2Library/locators/elementfinder.py b/src/Selenium2Library/locators/elementfinder.py index a165232a5..d4b886628 100644 --- a/src/Selenium2Library/locators/elementfinder.py +++ b/src/Selenium2Library/locators/elementfinder.py @@ -18,6 +18,7 @@ def __init__(self): 'jquery': self._find_by_sizzle_selector, 'sizzle': self._find_by_sizzle_selector, 'tag': self._find_by_tag_name, + 'scLocator': self._find_by_sc_locator, 'default': self._find_by_default } self._strategies = NormalizedDict(initial=strategies, caseless=True, spaceless=True) @@ -89,6 +90,10 @@ def _find_by_tag_name(self, browser, criteria, tag, constraints): return self._filter_elements( browser.find_elements_by_tag_name(criteria), tag, constraints) + + def _find_by_sc_locator(self, browser, criteria, tag, constraints): + js = "return isc.AutoTest.getElement('%s')" % criteria.replace("'", "\\'") + return self._filter_elements([browser.execute_script(js)], tag, constraints) def _find_by_default(self, browser, criteria, tag, constraints): if criteria.startswith('//'):