File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
py/selenium/webdriver/support Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ def select_by_visible_text(self, text: str) -> None:
115115 matched = False
116116 for opt in opts :
117117 if not self ._has_css_property_and_visible (opt ):
118- raise NoSuchElementException (f"Could not locate element with visible text: { text } " )
118+ raise NoSuchElementException (f"Invisible option with text: { text } " )
119119 self ._set_selected (opt )
120120 if not self .is_multiple :
121121 return
@@ -130,6 +130,8 @@ def select_by_visible_text(self, text: str) -> None:
130130 candidates = self ._el .find_elements (By .XPATH , xpath )
131131 for candidate in candidates :
132132 if text == candidate .text :
133+ if not self ._has_css_property_and_visible (candidate ):
134+ raise NoSuchElementException (f"Invisible option with text: { text } " )
133135 self ._set_selected (candidate )
134136 if not self .is_multiple :
135137 return
@@ -205,7 +207,7 @@ def deselect_by_visible_text(self, text: str) -> None:
205207 opts = self ._el .find_elements (By .XPATH , xpath )
206208 for opt in opts :
207209 if not self ._has_css_property_and_visible (opt ):
208- raise NoSuchElementException (f"Could not locate element with visible text: { text } " )
210+ raise NoSuchElementException (f"Invisible option with text: { text } " )
209211 self ._unset_selected (opt )
210212 matched = True
211213 if not matched :
You can’t perform that action at this time.
0 commit comments