MCPcopy
hub / github.com/plotly/dash / text_to_equal

Class text_to_equal

dash/testing/wait.py:102–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101
102class text_to_equal:
103 def __init__(self, selector, text, timeout):
104 self.selector = selector
105 self.text = text
106 self.timeout = timeout
107
108 def __call__(self, driver):
109 try:
110 elem = self._get_element(driver)
111 logger.debug("text to equal {%s} => expected %s", elem.text, self.text)
112 value = elem.get_attribute("value")
113 return str(elem.text) == self.text or (
114 value is not None and str(value) == self.text
115 )
116 except WebDriverException:
117 return False
118
119 def message(self, driver):
120 try:
121 element = self._get_element(driver)
122 text = "found: " + str(element.text) or str(element.get_attribute("value"))
123 except WebDriverException:
124 text = f"{self.selector} not found"
125 return f"text -> {self.text} not found within {self.timeout}s, {text}"
126
127 def _get_element(self, driver):
128 return driver.find_element(By.CSS_SELECTOR, self.selector)
129
130
131class style_to_equal:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…