Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- GIT
- d
- 목록처리
- resttemplate
- 스프링 시큐리티
- 처음 만나는 AI 수학 with Python
- 처음 만나는 AI수학 with Python
- 리눅스
- 스프링부트핵심가이드
- 구멍가게코딩단
- iterator
- 자료구조와 함께 배우는 알고리즘 입문
- 이터레이터
- 코드로배우는스프링부트웹프로젝트
- 알파회계
- 데비안
- 자료구조와함께배우는알고리즘입문
- Kernighan의 C언어 프로그래밍
- 페이징
- 선형대수
- baeldung
- ㅒ
- 티스토리 쿠키 삭제
- network configuration
- 서버설정
- /etc/network/interfaces
- 자바편
- 코드로배우는스프링웹프로젝트
- 친절한SQL튜닝
- 네트워크 설정
Archives
- Today
- Total
bright jazz music
pywinauto : 자동로그인 본문
from msilib import type_key
from pywinauto import application
from pywinauto import timings
import time
import os
app = application.Application()
app.start("C:/Program Files (x86)/NetMan/PClient/PClientUI.exe")
# ' / ' 대신 ' \ '를 사용하면 유니코드 에러 발생
# title = 'PClientUI' swapy에 표시된 이름 그대로 사용해야함
# title = 'PClient(32비트)' swapy에 표시된 이름 그대로 사용해야함
title = '보안접속 - PClient'
# dlg = timings.wait_until_passes(20, 0.5, lambda: app.window(title=title)) //입력되지 않음. app.connect 사용필요
dlg = timings.wait_until_passes(20, 0.5, lambda: app.connect(title=title)).Dialog
id_ctrl = dlg.Edit1
time.sleep(1)
# print('dlg.Edit1=', dlg.Edit1)
# print('id_ctrl=', id_ctrl.text)
id_ctrl.set_focus()
id_ctrl.type_keys("loginID") //로그인 할 아이디 입력
#
pw_ctrl = dlg.Edit2
time.sleep(1)
pw_ctrl.set_focus()
pw_ctrl.type_keys('password1234') //비밀번호 입력
#
# btn_ctrl = dlg.Button1
# btn_ctrl.click()
swapy 사용
실제 실행 시 오류
C:\Users\catnails\AppData\Local\Microsoft\WindowsApps\python3.10.exe D:/personal/pymath/np/auto_login.py
C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py:1085: UserWarning: 32-bit application should be automated using 32-bit Python (you use 64-bit Python)
warnings.warn(
C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py:1085: UserWarning: 32-bit application should be automated using 32-bit Python (you use 64-bit Python)
warnings.warn(
dlg.Edit1= <pywinauto.application.WindowSpecification object at 0x0000025CCB6A3130>
Traceback (most recent call last):
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py", line 250, in __resolve_control
ctrl = wait_until_passes(
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\personal\pymath\np\auto_login.py", line 22, in <module>
print('id_ctrl=', id_ctrl.text)
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py", line 379, in __getattribute__
ctrls = self.__resolve_control(self.criteria)
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py", line 261, in __resolve_control
raise e.original_exception
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(*args, **kwargs)
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\application.py", line 222, in __get_ctrl
ctrl = self.backend.generic_wrapper_class(findwindows.find_element(**ctrl_criteria))
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\findwindows.py", line 84, in find_element
elements = find_elements(**kwargs)
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\findwindows.py", line 305, in find_elements
elements = findbestmatch.find_best_control_matches(best_match, wrapped_elems)
File "C:\Users\catnails\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pywinauto\findbestmatch.py", line 536, in find_best_control_matches
raise MatchError(items = name_control_map.keys(), tofind = search_text)
pywinauto.findbestmatch.MatchError: Could not find 'Edit1' in 'dict_keys(['알림Static', 'Static', '알림', '로그인 되었습니다.', 'Static0', 'Static1', 'Static2', '로그인 되었습니다.Static', 'hjcha 님으로', 'Static3', 'hjcha 님으로Static', 'Button', '닫기Button', '닫기'])'
Process finished with exit code 1
Comments