test/framework/web/action/web_action_get_text.py
croy 82d417b9e6 New StarlingX Automation Framework
Fresh start for the StarlingX automation framework.

Change-Id: Ie265e0791024f45f71faad6315c2b91b022934d1
2024-11-29 16:01:57 -05:00

35 lines
893 B
Python

from framework.web.action.web_action import WebAction
class WebActionGetText(WebAction):
"""
Class representing the action of getting the text contents of an element.
"""
def perform_action(self, web_element, *args):
"""
Override the parent's perform action by getting the text of an element.
Args:
web_element: Element of interest.
*args: Unused arguments to follow the override signature.
Returns: None
"""
web_element_text = web_element.text
# Sometimes, the text is contained in the 'value' attribute of the element.
if not web_element_text:
web_element_text = web_element.get_attribute('value')
return web_element_text
def __str__(self):
"""
String representation of this action.
Returns:
"""
return "GetText"