Skip to content

Commit 8cd0149

Browse files
committed
Update error message for trying to pass a non-string as a selector
1 parent 9f405bd commit 8cd0149

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5873,7 +5873,11 @@ def __click_dropdown_partial_link_text(self, link_text, link_css):
58735873
return False
58745874

58755875
def __recalculate_selector(self, selector, by):
5876-
# Try to determine the type of selector automatically
5876+
# Use auto-detection to return the correct selector with "by" updated
5877+
_type = type(selector) # First make sure the selector is a string
5878+
if _type is not str:
5879+
msg = 'Expecting a selector of type: "<class \'str\'>" (string)!'
5880+
raise Exception('Invalid selector type: "%s"\n%s' % (_type, msg))
58775881
if page_utils.is_xpath_selector(selector):
58785882
by = By.XPATH
58795883
if page_utils.is_link_text_selector(selector):

0 commit comments

Comments
 (0)