在child_window pywinauto中传递变量

时间:2017-12-19 21:32:42

标签: python pywinauto

使用pywinauto时,是否可以在child_window对象中使用变量名作为参数?

而不是

app.Dialog.child_window(title='Position',class_name='RibbonPageHeaderControl').select()

当我使用tabName ='Position'

app.Dialog.child_window("title='"+tabName+"'",class_name='RibbonPageHeaderControl').select()

我收到错误:

tabSel.selectSubTab('Position','Depository Details')
  File "C:/myCode/AutomationSuites/CCMP/Functions\Tab.py", line 21, in selectSubTab
    Tab.selectTab(app,tabName)
  File "C:/myCode/AutomationSuites/CCMP/Functions\Tab.py", line 17, in selectTab



app.Dialog.child_window("title='"+tabName+"'",class_name='RibbonPageHeaderControl').select()
TypeError: child_window() takes 1 positional argument but 2 were given

1 个答案:

答案 0 :(得分:0)

我能够使用以下方法解决此问题:

app.Dialog.child_window(标题="&#34 + + TABNAME"",CLASS_NAME =' RibbonPageHeaderControl&#39)。选择()