android – How to access element in Appium logcat with python

I am trying to access the appium logcat “message”element with python, I am not super familiar with python and appium.

It seems like the get_log(‘logcat’) with return a json type of result, and I want to put that in dictionary and access the “message” element, I have been googling a lot still not sure how to do it. Hopefully someone can help me out a bit on that.

log = driver.get_log('logcat')
logcat_string = json.dumps(log)
logcat_item = json.loads(logcat_string)

appium_message = logcat_item["message"]
print("Appium message "+appium_message)

appium_jsonlog = open("appium_log.json", "w")
appium_jsonlog .close()

enter image description here

Read more here: Source link