Search code examples
pythonseleniumwinium

How to inspect elements in Winium


I have started using Winium automation tool to automate windows apps. I am new to this tool and I am not finding any documentation for solving my doubts.

Following is the basic code that I have refered to start using Winium.

import time
from selenium import webdriver

driver = webdriver.Remote(
    command_executor='http://localhost:9999',
    desired_capabilities={
        "debugConnectToRunningApp": 'false',
        "app": r"C:/windows/system32/notepad.exe"
    })

window = driver.find_element_by_class_name("Notepad")
window.send_keys("example text")

My query is how we inspect elements in windows applications ? Above code will open Notepad and will type "example text" in it.It finds the text field using driver.find_element_by_class_name("Notepad").Similarly how can I inspect other elements of the Notepad window.Like File menu option? Also it would be really nice if anyone provides me link for a documentation of Winium.


Solution

  • To find the element OR properties of a windows application we use “Inspect.exe” which is available by default in windows if not just download it.It gives all the properties of a desktop application to control it.

    Inspect.exe documentation

    Basic Winium Example

    Resource link

    Winium Inspector

    For More information about Windows based UI Inspector refer this : more info

    Also you can use : UI SPY

    enter image description here