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') print(log) 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.write(logcat_string) appium_jsonlog .close()
Read more here: Source link