環境構築が整ったらプログラミングを行います。
Python
# 必要なライブラリのインポート
from appium import webdriver
from selenium.webdriver.common.keys import Keys
# 起動されているWindows Application Driverへ接続する
# この例では、アプリケーション全体(App=Root)を対象として4999番ポートで起動されたWADへ接続している。
# 特定のアプリを起点としたい場合は、desired_caps["app"] = "C:\\hoge.exe" とする。
desired_caps = {}
desired_caps["app"] = "Root"
driver = webdriver.Remote(command_executor='http://127.0.0.1:4999', desired_capabilities= desired_caps)
# 要素の指定
xpath_str = \
"/".join(['ここにWinAppDriverUiRecorderで調査したxpathを書く'])
# キー入力
driver.find_element_by_xpath(xpath_str).send_keys(キーを書く)
# クリック
driver.find_element_by_xpath(xpath_str).click()
# 文字を取得
driver.find_element_by_xpath(xpath_str).text
番外編!Pythonコードをexeファイル化する
1.pyinstallerをインストールする
pip install pyinstaller
2.pyinstallerコマンドで.pyファイルをexeファイルにする
pyinstaller [ファイル名].py --onefile
3.成功すると実行したフォルダ下にdistフォルダが作られておりその中にexeファイルが出来る