class tt(): def __init__(self): self.a2={"客户编码":1,"客户名称":2,"增值税号":27,"公司地址":30,"联系电话":35,"开户行":25,"开户行账号":26,"财务编码(财务填写)":1,"企业名称":2,"联系人":21,"联系地址":30,"客户编码(财务输出)":1,"银行账号":26,"引进组织":8} self.a="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[1]/div/div/button[{}]/span"#增加1\保存4 self.a1="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/form/div[{}]/div/div/div/div/input"#信息录入 self.a3="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/form/div[40]/div/div/div/div/div/input" self.a4="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/form/div[3]/div/div/div/div[1]/input" self.a5="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/form/div[4]/div/button[1]/span"#查询 self.a6="//*[@id=\"app\"]/div/div[2]/section/div/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div[1]/div[2]/div/div[2]/div/div[2]/div[1]/div[2]/table/tbody/tr/td[2]/div/div" def x1(self):#点编辑 browser.find_element_by_xpath(a.format(2)).click() def x2(self,a): browser.find_element_by_xpath(self.a4).click() browser.find_element_by_xpath(self.a4).clear() browser.find_element_by_xpath(self.a4).send_keys(a) browser.find_element_by_xpath(self.a5).click() browser.find_element_by_xpath(self.a6).click() def x3(self,a,a1): browser.find_element_by_xpath(self.a1.format(a)).click() browser.find_element_by_xpath(self.a1.format(a)).clear() browser.find_element_by_xpath(self.a1.format(a)).send_keys(a1) tt.x3(8,"C000")TypeError: x3() missing 1 required positional argument: 'a1' 修改下
时间: 2024-01-28 11:03:28 浏览: 62
你可以把函数调用改为对象方法调用,需要先创建一个 tt 对象才能调用该对象的方法。示例代码如下:
```
t = tt()
t.x3(8, "C000")
```
这样就可以避免 TypeError: x3() missing 1 required positional argument: 'a1' 的错误提示了。
阅读全文