My Autoit.exe doesn’t work when combining with seelenium

  Kiến thức lập trình

Could you please advice me if I need to correct something?

— Below is my script in “autoit” called “CloseWindow.exe”: (converted by CloseWindow.au3 for x64)
WinClose("Information")
I can execute it successfully if I run this script alone

— But when I combine it into my Selenium Script, my code of “CloseWindow.exe” doesn’t work:

import time
import os
import autoit
import subprocess

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service

vr_Chrome_Options = Options()
vr_Chrome_Options.binary_location = "C:\Program Files (x86)\ABC\ABC_App\ABC.exe"
        
#-- Open Aladdin Primary Port - Primary Window:
vr_Chrome_Options.add_argument("--remote-debugging-port=9222")
vr_Chrome_Service = Service(executable_path="C:\Users\dtieu\.cache\selenium\chromedriver\win64\chromedriver_win32_version_90\chromedriver.exe")
Driver = webdriver.Chrome(service=vr_Chrome_Service, options=vr_Chrome_Options)
time.sleep(10)
Driver.switch_to.window(Driver.window_handles[0])

vr_Connect_Device = Driver.find_element(By.XPATH, "xpathvalue...").click()
time.sleep(15)
vr_Set_Date_Time_into_SUT_Button = Driver.find_element(By.XPATH, "xpathvalue...").click()
time.sleep(10)

autoit_script_path = "D:\PYTHON\ABC_Testing\CloseWindow.exe"
os.system(autoit_script_path) ```


Beside using os.system, I also try with subprocess.run
But both doesn't work.

But I can run ABC.au3 successfully. It means no problem with my script on 'ABC.au3'
Then, I convert "CloseWindow.au3" into "CloseWindow.exe"


Thanks,

LEAVE A COMMENT