import time
from pywinauto.application import Application
# Run a target application
app = Application().start("C:\ProgramFiles\BatonMediaPlayer\BatonMediaPlayer.exe")
time.sleep(5)
# Select a menu item
print app.BatonMediaPlayer.Children()
print "app.BatonMediaPlayer.SetFocus()", app.BatonMediaPlayer.SetFocus()
time.sleep(1)
app.BatonMediaPlayer.menu_select('Help->About')
-2
A
回答
0
好的,如果這是Qt5應用程序,WireShark example at lines 58-63可能會幫助您調整您的應用程序的代碼。它應該看起來像這樣:
import time
from pywinauto.application import Application
# Run a target application
app = Application(backend='uia').start(r"C:\ProgramFiles\BatonMediaPlayer\BatonMediaPlayer.exe")
time.sleep(5)
win = app['Dialog'] # or app.ApproximateMainWindowTitle
win['Help'].select() # exapnd submenu
submenu = app[''] # Dropdown submenu is a top-level window
submenu['About'].select() # or .click_input()
希望它的工作方式與WireShark相同。
+0
謝謝你。 –
+0
但是它給了我NameError:name'win'沒有定義。 –
+0
對不起,錯過了這一行:'win = app ['Dialog']'(編輯了答案)。 –
相關問題
- 1. jQuery find className not for for second click function
- 2. 爲什麼<a href=#A> and jquery click function not work together?
- 3. ng-click for ionic ios is not working
- 4. isundoing and isredoing for NSUndoMananger is not in Swift
- 5. React router「context.router.transitionTo is not a function」
- 6. Javascript「Uncaught TypeError:object is not a function」
- 7. The Alamofire is not for a larg image
- 8. RegEx for a Glossary Function
- 9. customAdapter for object is not
- 10. Javascript not trigering and alert function is working
- 11. 爲什麼我的<a href="test.xls"> is working and .txt is not?
- 12. Curl post not working is my correct correct for this post form?
- 13. 「document.forms is not a function」with「document.forms(0)」
- 14. 「Python NameError:name is not defined」for
- 15. Bypass for can not re-declare function
- 16. Javascript:String.replace for space is not working
- 17. On Click and Opacity for simple Biography滑塊
- 18. Logback not for INFO and ERROR
- 19. Select count,group by query is not picking records for NULL and Empty String Column Values
- 20. Compling my VB.NET WinForms apps for ARM and Windows RT
- 21. Zombie.js「assert is not defined」for multiple visits?
- 22. 用於Mac的Python pywinauto for Audacity
- 23. css for sticky footer not coming at proper position
- 24. TypeError(「'int'object is not iterable」,in my python 3
- 25. Javascript「not a function」
- 26. $(#cart-continue).click(function)not called
- 27. position:fixed not for for navigation
- 28. jQuery驗證:Uncaught TypeError:$(...)。「valid is not a function」with valid references/order
- 29. (document).ready(function()is not running the function
- 30. Run As TestNG is not for class extends AbstractTestNGCucumberTests
您是否嘗試以管理員身份運行您的腳本? 「Spy ++」或「Inspect.exe」可以看到這些控件嗎?請提供更多細節。 –
我沒有運行它作爲管理員,但當我做了IsActive()顯示正確,但MenuSelect功能仍然顯示「沒有菜單」的錯誤。 –
我正在嘗試使用Inspect.exe。 –