如何解决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 举报,一经查实,本站将立刻删除。