在线程中运行Robot文件(对话框)

2024-04-20 07:45:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要能够在线程中运行.robot文件的程序,我正在写,但每当有一个对话框,测试自动失败,并说

Dialogs library is not supported with timeouts on Python on this platform.

有没有人知道一个可行的解决方案,让一个带有对话框的robot文件能够在线程中运行?没有对话框的Robot文件在线程中运行得非常好。你知道吗

import os
import threading
import robot

robot_test_object = []
for root, _, files in os.walk(str("C:/Users/Desktop/test")):
    for file in files:
        if file.endswith(".robot"):
            robot_test_object.append(str(os.path.join(root, file)))
            print(robot_test_object)


def Run_Button():

    run_thread = threading.Thread(target=Run_Robot_Files)
    run_thread.daemon = True
    run_thread.start()

def Run_Robot_Files():
    for robot_tests in robot_test_object:
        robot.run(robot_tests)

Tags: 文件runintestimportforobjectos