使用Win32GUI和Watsup,我正在编写一段Python代码来自动执行跨数据库的搜索,该数据库可以通过未附带接口的程序访问。因此,我可以从列表中获取一个字符串,然后将其输入到搜索框并按'查找'。如何阻止警告对话框停止执行控制它的Python程序?
但是,当搜索返回1000个以上的结果时,程序会抛出一个警告对话框 - 这只是一个结果数量的通知 - 暂停执行Python代码。我无法让代码继续沿着查找的路线前进。
有人猜测,这可能是因为它不期望一个窗口或知道如何处理警告 - 但我也没有,除了手动接受它。下面是相关的代码示例,尽管它可能不是非常有启发性。在“clickButton(LookupButton)”之后,执行暂停。
LookupButtonlocation = elemstring.find("Lookup", AuthNameFieldlocation) - 15
#Use Regex search to find handles
number_regex = re.compile(';(\d+);')
AuthNameEdit = int(number_regex.search(elemstring[AuthNameFieldlocation:]).group(1))
LookupButton = int(number_regex.search(elemstring[LookupButtonlocation:]).group(1))
#Input new Author into Edit Field
setEditText(AuthNameEdit, "John Campbell")
#Click lookup button
clickButton(LookupButton)