AutoIT脚本在selenum python中正确运行以加载文件win dialogat但在无头模式下失败

问题描述

当我将驱动程序设置为在Windows模式下运行时,它已通过,并且我看到文件已加载: 驱动程序= webdriver.Chrome('./ chromedriver') 但是当我将驱动程序设置为以无头模式运行时,无法加载文件: driver = webdriver.Chrome('./ chromedriver',chrome_options = chrome_options)

我的脚本如下:

WinWaitactive(“打开”)

发送(“ C:\ Users \ rbassx \ Documents \ TBT \ TCM \ GIT_New \ tbz_automation \ automation_tests \ GR.bin”)

发送(“ {ENTER}”)

和python中的

class TestConfiguration:
    chrome_options = Options()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-gpu")
    chrome_options.add_argument("--window-size=1920,1080")
    chrome_options.add_argument("start-maximized")
    chrome_options.add_argument("--no-sandBox")
    chrome_options.add_argument('disable-infobars')
    chrome_options.add_argument("--disable-extensions")
    #driver = webdriver.Chrome('./chromedriver')
    driver = webdriver.Chrome('./chromedriver',chrome_options=chrome_options)



   def load_image(self,file_path):
       autoit = comclt.dispatch("AutoItX3.Control")
       autoit.Run(r"Script.exe")
       TestConfiguration.driver.find_element_by_class_name("MuiButtonBase-root").click()
       time.sleep(5)
       autoid_back_button = GuiTestLibrary.project_mapping['common']['back_button']['AutomationId']
       webdriverwait(TestConfiguration.driver,10).until(ec.visibility_of_element_located((By.ID,autoid_back_button)))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)