python - 不知道Bug在哪?
本文介绍了python - 不知道Bug在哪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
from pywinauto.application import Application
import time
class start():
def __int__(self, com, url):
self.com = com
self.url = url
self.app = Application(backend='uia').start(url)
self.dlg = self.app.window(title_re=".*输入端口*")
def start_ui(self):
if self.com:
self.ComboBox.select(self.com)
time.sleep(2)
self.dlg.确定.click()
else:
self.dlg['TitleBar'].关闭.click()
time.sleep(1)
self.dlg['关闭'].Button2.click()
self.dlg['TitleBar'].关闭.click()
time.sleep(1)
self.dlg['关闭'].Button.click()
com = 'COM4'
url = 'C:\Program Files (x86)\EwayBot\ActuaticUI\ActuaticUI.exe'
h=start(com, url)
错误提示:
C:\Users\fc\AppData\Local\Programs\Python\Python36\python.exe C:/Users/fc/Desktop/ActuaticUI-automation-Test/1.py
Traceback (most recent call last):
File "C:/Users/fc/Desktop/ActuaticUI-automation-Test/1.py", line 28, in <module>
h=start(com, url)
TypeError: object() takes no parameters
Process finished with exit code 1
我那个init旁边是两个下划线没错,完全找不到bug,麻烦大家看看
解决方案
拼写错误导致继承了object类的__init__方法,该方法不接受除了self以外的实参
这篇关于python - 不知道Bug在哪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文