调用pyautoGUI里的typewrite()函数,在某些输入框里的输入会大小写混乱,-和_混乱
xml文件:
<Case caseSummary="test">
<Steps>
<step stepname="write">IMAN_specification</step>
</Steps>
</Case>
部分代码:
def write(stepBO,stepID):
pyautogui.typewrite(stepBO)
logging.info("step"+ str(stepID) + ': execute step write [' + stepBO + ']\n')
time.sleep(2)
i = 1
return i
Steps = Case.getElementsByTagName("step")#从xml读取value
For step in Steps:
stepBO = step.firstChild.data
stepname = step.getAttribute('stepname')
if stepname="write":
stepresult = write(stepBO, step_ID)
运行结果:
第一次运行,在特定窗口输入的是IMan_specification
第二次运行,在特定窗口输入的是Iman-specification
运行在cmd/text/邮件文本里,输入的是正确的IMAN_specification