Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit 1e11d9c

Browse files
RodaxQAGuillaume Delaval
andauthored
fix: get element text keyword (#9) (#10)
Co-authored-by: Guillaume Delaval <guillaume.delaval@orange.com>
1 parent e948d0c commit 1e11d9c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

AppiumFlutterLibrary/keywords/_element.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ def get_element_text(self, locator):
9191
9292
If the element does not support getText() raise an error.
9393
"""
94-
element = self._find_element(locator)
95-
return self._get_element_text(element)
94+
text = self._get_text(locator)
95+
self._info("Element '%s' text is '%s' " % (locator, text))
96+
return text
9697

9798
def _is_visible(self, element):
9899
application = self._current_application()
@@ -103,6 +104,9 @@ def _find_element(self, locator):
103104
application = self._current_application()
104105
return self._element_finder.find(application, locator)
105106

106-
def _get_element_text(self, element):
107-
application = self._current_application()
108-
return application.execute_script('flutter:getText', element)
107+
def _get_text(self, locator):
108+
element = self._find_element(locator)
109+
if element is not None:
110+
return element.text
111+
return None
112+

0 commit comments

Comments
 (0)