Closed snowman closed 3 years ago
cmd> python automation_calculator.py 2020-03-27 10:07:27.998 automation_calculator.py[131] CalcOnWindows10 -> {ClassName: 'ApplicationFrameWindow', Compare: <function CalcOnWindows10.<locals>.<lambda> at 0x0000023EFF2D69D0>, Desc: 'Calculator Window', ControlType: WindowControl} TraverseControls: 12, SearchTime: 0.089s[10:07:27.910362 - 10:07:27.998808] 2020-03-27 10:07:28.685 automation_calculator.py[134] CalcOnWindows10 -> {AutomationId: 'TogglePaneButton', ControlType: ButtonControl} TraverseControls: 134, SearchTime: 0.074s[10:07:28.612021 - 10:07:28.685563] 2020-03-27 10:07:29.754 automation_calculator.py[135] CalcOnWindows10 -> {AutomationId: 'Scientific', ControlType: ListItemControl} TraverseControls: 145, SearchTime: 0.078s[10:07:29.676681 - 10:07:29.754939] 2020-03-27 10:07:30.566 automation_calculator.py[136] CalcOnWindows10 -> {AutomationId: 'clearButton', ControlType: ButtonControl} TraverseControls: 50, SearchTime: 0.039s[10:07:30.526825 - 10:07:30.566401] 12020-03-27 10:07:31.591 automation_calculator.py[23] Calc -> {AutomationId: 'num1Button', Desc: 'Button 1', ControlType: ButtonControl} TraverseControls: 98, SearchTime: 0.059s[10:07:31.532183 - 10:07:31.591949] 22020-03-27 10:07:32.103 automation_calculator.py[23] Calc -> {AutomationId: 'num2Button', Desc: 'Button 2', ControlType: ButtonControl} TraverseControls: 100, SearchTime: 0.055s[10:07:32.049496 - 10:07:32.103432] 32020-03-27 10:07:32.520 automation_calculator.py[23] Calc -> {AutomationId: 'num3Button', Desc: 'Button 3', ControlType: ButtonControl} TraverseControls: 102, SearchTime: 0.056s[10:07:32.463884 - 10:07:32.520175] 42020-03-27 10:07:32.944 automation_calculator.py[23] Calc -> {AutomationId: 'num4Button', Desc: 'Button 4', ControlType: ButtonControl} TraverseControls: 104, SearchTime: 0.058s[10:07:32.887437 - 10:07:32.944882] *2020-03-27 10:07:33.448 automation_calculator.py[23] Calc -> {AutomationId: 'multiplyButton', Desc: 'Button *', ControlType: ButtonControl} TraverseControls: 85, SearchTime: 0.048s[10:07:33.400471 - 10:07:33.448319] (2020-03-27 10:07:34.030 automation_calculator.py[23] Calc -> {AutomationId: 'openParenthesisButton', Desc: 'Button (', ControlType: ButtonControl} TraverseControls: 75, SearchTime: 0.046s[10:07:33.983994 - 10:07:34.030267] 4+2020-03-27 10:07:34.857 automation_calculator.py[23] Calc -> {AutomationId: 'plusButton', Desc: 'Button +', ControlType: ButtonControl} TraverseControls: 89, SearchTime: 0.055s[10:07:34.801540 - 10:07:34.856473] 52020-03-27 10:07:35.458 automation_calculator.py[23] Calc -> {AutomationId: 'num5Button', Desc: 'Button 5', ControlType: ButtonControl} TraverseControls: 106, SearchTime: 0.058s[10:07:35.400637 - 10:07:35.458472] +62020-03-27 10:07:36.329 automation_calculator.py[23] Calc -> {AutomationId: 'num6Button', Desc: 'Button 6', ControlType: ButtonControl} TraverseControls: 108, SearchTime: 0.060s[10:07:36.268283 - 10:07:36.328047] )2020-03-27 10:07:36.752 automation_calculator.py[23] Calc -> {AutomationId: 'closeParenthesisButton', Desc: 'Button )', ControlType: ButtonControl} TraverseControls: 78, SearchTime: 0.049s[10:07:36.704151 - 10:07:36.751911] -2020-03-27 10:07:37.171 automation_calculator.py[23] Calc -> {AutomationId: 'minusButton', Desc: 'Button -', ControlType: ButtonControl} TraverseControls: 87, SearchTime: 0.050s[10:07:37.121278 - 10:07:37.171017] 72020-03-27 10:07:37.702 automation_calculator.py[23] Calc -> {AutomationId: 'num7Button', Desc: 'Button 7', ControlType: ButtonControl} TraverseControls: 110, SearchTime: 0.082s[10:07:37.621501 - 10:07:37.702591] 82020-03-27 10:07:38.318 automation_calculator.py[23] Calc -> {AutomationId: 'num8Button', Desc: 'Button 8', ControlType: ButtonControl} TraverseControls: 112, SearchTime: 0.060s[10:07:38.258421 - 10:07:38.318131] /2020-03-27 10:07:38.769 automation_calculator.py[23] Calc -> {AutomationId: 'divideButton', Desc: 'Button /', ControlType: ButtonControl} TraverseControls: 83, SearchTime: 0.063s[10:07:38.706643 - 10:07:38.769796] 92020-03-27 10:07:39.297 automation_calculator.py[23] Calc -> {AutomationId: 'num9Button', Desc: 'Button 9', ControlType: ButtonControl} TraverseControls: 114, SearchTime: 0.061s[10:07:39.238072 - 10:07:39.297910] 02020-03-27 10:07:39.728 automation_calculator.py[23] Calc -> {AutomationId: 'num0Button', Desc: 'Button 0', ControlType: ButtonControl} TraverseControls: 96, SearchTime: 0.053s[10:07:39.675598 - 10:07:39.728457] .2020-03-27 10:07:40.208 automation_calculator.py[23] Calc -> {AutomationId: 'decimalSeparatorButton', Desc: 'Button .', ControlType: ButtonControl} TraverseControls: 116, SearchTime: 0.071s[10:07:40.137913 - 10:07:40.208723] 8=2020-03-27 10:07:40.923 automation_calculator.py[23] Calc -> {AutomationId: 'equalButton', Desc: 'Button =', ControlType: ButtonControl} TraverseControls: 91, SearchTime: 0.051s[10:07:40.873457 - 10:07:40.923570] 18509.140969162995594713656387665 3*3+4*4=25 2*3.14159*10=62.8318 Can not load dll. Functionalities related to Bitmap are not available. You may need to install Microsoft Visual C++ 2010/2015 Redistributable Package. Traceback (most recent call last): File "automation_calculator.py", line 161, in <module> CalcOnWindows10() File "automation_calculator.py", line 149, in CalcOnWindows10 calcWindow.CaptureToImage('calc.png', 7, 0, -14, -7) # on windows 10, 7 pixels of windows border are transparent File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomation\uiautomation.py", line 6174, in CaptureToImage if bitmap.FromControl(self, x, y, width, height): File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomation\uiautomation.py", line 3003, in FromControl return self.FromHandle(handle, left, top, right, bottom) File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomation\uiautomation.py", line 2958, in FromHandle self._bitmap = _DllClient.instance().dll.BitmapFromWindow(root.NativeWindowHandle, left, top, right, bottom) AttributeError: 'NoneType' object has no attribute 'BitmapFromWindow'
是不是python3.8?python 3.8默认不能加载当前目录下dll, 最新版已修复