test/framework/web/action/web_action_set_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

30 lines
799 B
Python

from framework.web.action.web_action import WebAction
class WebActionSetText(WebAction):
"""
Class representing a Web action of Setting the text content of an element.
"""
def perform_action(self, web_element, *args):
"""
Override the parent's perform action - Clears the text and then sets the text of the web_element to the argument passed in.
Args:
web_element: Element to set the text of.
*args: One 'str' argument; The text to write in the web_element.
Returns: None
"""
text_to_set = args[0]
web_element.clear()
web_element.send_keys(text_to_set)
def __str__(self):
"""
String representation of this action.
Returns:
"""
return "SetText"