2

I want to control the dialog which is launched by Internet Explorer's ActiveX.

enter image description here

app = Application(backend="uia").connect(title = "감염병웹통계시스템 - Internet Explorer")
tb = app.window(class_name = "IEFrame").window(class_name = "AfxOleControl90su").window(class_name = "XTPToolBar")
tb.파일저장.click()

with this code, I can open the dialog. But I can't handle it. I found out that Internet Explorer is using 2 processes.

And Original Internet Explorer is under 64 bit and the dialog is under 32 bit Internet Explorer. So I decided to create new Application and connect to 32 bit process.

app2 = Application(backend="uia").connect(path=r"C:\Program Files (x86)\Internet Explorer\iexplore.exe", title = "감염병웹통계시스템 - Internet Explorer")
dialog = app2.window_(best_match = "Dialog")
dialog.print_control_identifiers()

But there is no output of print_control_identifiers. Nothing happens. When I cancel the dialog, then terminal show this error message.

(oh-crawler) c:\work\oh-crawler>python crawler2.py
Traceback (most recent call last):
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\application.py", line 243, in __resolve_control
    criteria)
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\timings.py", line 424, in wait_until_passes
    raise err
pywinauto.timings.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "crawler2.py", line 18, in <module>
    dialog.print_control_identifiers()
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\application.py", line 573, in print_control_identifiers
    this_ctrl = self.__resolve_control(self.criteria)[-1]
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\application.py", line 246, in __resolve_control
    raise e.original_exception
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\timings.py", line 402, in wait_until_passes
    func_val = func(*args)
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\application.py", line 188, in __get_ctrl
    dialog = self.backend.generic_wrapper_class(findwindows.find_element(**criteria[0]))
  File "C:\Anaconda3\envs\oh-crawler\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element
    raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'best_match': 'Dialog', 'backend': 'uia', 'process': 5244}

I'm thinking that there are 2 possibilities. First I made a mistake to connect to the process. Second I made a mistake to attach a dialog window.

Here is the information I got from different kind of spy tools. enter image description here

How can I control this dialog?

=======================================

2017-07-05 I changed inpect.exe's mode to UI Automation and captured again. enter image description here

저장 means "Save" And this is ActiveX program folder. enter image description here

Can it be a custom control? So can't handle of this control because of comtype restriction?

argenhong
  • 21
  • 3
  • Please switch `Inspect.exe` from "MSAA" to "UIAutomation" mode. Is this "Save" dialog a child of 64-bit IE window in Inspect.exe? – Vasily Ryabov Jul 05 '17 at 09:58
  • No. "Save" Dialog is a child of 32-bit IE window in inspect.exe. I really feel good that the author of pywinauto commented on my question. – argenhong Jul 05 '17 at 14:53
  • I tested on python3 32 bit and 64bit(different computer). But it was the same. – argenhong Jul 05 '17 at 15:04
  • Ah, now I see `Inspect.exe` shows the combo box has [No Parent] (at the end of properties list) but it has ancestors. So the child knows about parents, but parents don't know about this child. :) This is a little bit difficult situation because you can't find this element by just walking the elements tree. This element can be obtained by `ElementFromPoint` method that I've just started to use (thanks for [this answer](https://stackoverflow.com/q/44826285/3648361)). – Vasily Ryabov Jul 06 '17 at 10:02
  • Hmm... Your `Inspect.exe` version doesn't have `"Show Tree"` toolbar button. Is there menu item "Options->Show Tree"? If no which operating system do you use? – Vasily Ryabov Jul 06 '17 at 10:18
  • Also I see the combo box has `NativeWindowHandle` property. It means you can use Spy++ tool (from Visual Studio) to view the hierarchy. If it looks OK in Spy++, then you can use `backend="win32"` as well (it may work faster than "uia"). – Vasily Ryabov Jul 06 '17 at 10:25
  • Do you have any news on that with `backend="win32"` and Spy++? – Vasily Ryabov Jul 17 '17 at 17:25

0 Answers0