Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
declarations = (
# Browser Management
{ "name": "open browser", "function": "Open_Browser", "screenshot": "web" },
{ "name": "open electron app", "function": "Open_Electron_App", "screenshot": "web" },
{ "name": "go to link", "function": "Go_To_Link", "screenshot": "web" },
{ "name": "go to link v2", "function": "Go_To_Link_V2", "screenshot": "web" },
{ "name": "tear down browser", "function": "Tear_Down_Playwright", "screenshot": "none" },
{ "name": "teardown", "function": "Tear_Down_Playwright", "screenshot": "none" },
{ "name": "switch browser", "function": "Switch_Browser", "screenshot": "none" },
Expand All @@ -21,6 +23,7 @@
{ "name": "double click", "function": "Double_Click_Element", "screenshot": "web" },
{ "name": "right click", "function": "Right_Click_Element", "screenshot": "web" },
{ "name": "hover", "function": "Hover_Over_Element", "screenshot": "web" },
{ "name": "click and download", "function": "Click_and_Download", "screenshot": "web" },

# Text Input
{ "name": "text", "function": "Enter_Text_In_Text_Box", "screenshot": "web" },
Expand All @@ -34,6 +37,8 @@

# Element Information
{ "name": "save attribute", "function": "Save_Attribute", "screenshot": "web" },
{ "name": "change attribute value", "function": "Change_Attribute_Value", "screenshot": "web" },
{ "name": "capture network log", "function": "capture_network_log", "screenshot": "web" },
{ "name": "get element info", "function": "get_element_info", "screenshot": "web" },
{ "name": "extract table data", "function": "Extract_Table_Data", "screenshot": "web" },

Expand All @@ -45,6 +50,11 @@
{ "name": "scroll", "function": "Scroll", "screenshot": "web" },
{ "name": "scroll to element", "function": "scroll_to_element", "screenshot": "web" },
{ "name": "scroll element to top", "function": "scroll_to_element", "screenshot": "web" },
{ "name": "scroll to top", "function": "scroll_to_top", "screenshot": "web" },

# Lists / attributes
{ "name": "save attribute values in list", "function": "save_attribute_values_in_list", "screenshot": "web" },
{ "name": "save web elements in list", "function": "save_web_elements_in_list", "screenshot": "web" },

# Selection (Dropdowns/Checkboxes)
{ "name": "select by visible text", "function": "Select_Deselect", "screenshot": "web" },
Expand All @@ -55,6 +65,9 @@
{ "name": "deselect by index", "function": "Select_Deselect", "screenshot": "web" },
{ "name": "deselect all", "function": "Select_Deselect", "screenshot": "web" },
{ "name": "check uncheck", "function": "check_uncheck", "screenshot": "web" },
{ "name": "check uncheck all", "function": "check_uncheck_all", "screenshot": "web" },
{ "name": "multiple check uncheck", "function": "multiple_check_uncheck", "screenshot": "web" },
{ "name": "slider bar", "function": "slider_bar", "screenshot": "web" },

# Window/Tab Management
{ "name": "switch window", "function": "switch_window_or_tab", "screenshot": "web" },
Expand All @@ -80,6 +93,7 @@

# File Upload
{ "name": "upload file", "function": "upload_file", "screenshot": "web" },
{ "name": "copy image into browser", "function": "copy_image_into_browser", "screenshot": "web" },

# Window Management
{ "name": "resize window", "function": "resize_window", "screenshot": "web" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3723,7 +3723,7 @@ def _print(*args, sep=' ', end='\n', file=None, dont_send=False):


@logger
def execute_python_code(data_set):
async def execute_python_code(data_set):
try:
sModuleInfo = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME
inp, out_var, main_function, Code, filepath_code = "", "", "", "", ""
Expand All @@ -3749,10 +3749,31 @@ def execute_python_code(data_set):

Code = filepath_code if filepath_code else Code
sr.shared_variables["print"] = _print
try:
from Framework.Built_In_Automation.Web import utils as WebUtils

await WebUtils.hydrate_browser_compatibility_globals(data_set)
except Exception:
CommonUtil.ExecLog(
sModuleInfo,
"Could not hydrate browser compatibility globals before executing python code",
2,
)
CommonUtil.Exception_Handler(sys.exc_info())
previous_vars = set(sr.shared_variables)

try: exec(Code, sr.shared_variables)
except: return CommonUtil.Exception_Handler(sys.exc_info())
try:
compiled_code = compile(
Code,
"<execute_python_code>",
"exec",
flags=ast.PyCF_ALLOW_TOP_LEVEL_AWAIT,
)
exec_result = eval(compiled_code, sr.shared_variables)
if inspect.isawaitable(exec_result):
await exec_result
except:
return CommonUtil.Exception_Handler(sys.exc_info())

try:
current_vars = set(sr.shared_variables)
Expand Down
Loading
Loading