public override bool ContainsText(string text) { return(TizenAppium.RunOnMainThread <bool>(() => { string[] TextProperties = { "Text", "Label" }; foreach (var prop in TextProperties) { var value = Control?.GetType().GetProperty(prop)?.GetValue(Control).ToString(); if (value == text) { return true; } } string[] TextParts = { "elm.text", "elm.test.end", "elm.test.sub", "elm.test.sub.end", "elm.swallow.content" }; foreach (var part in TextParts) { string str = Control?.GetPartText(part); if (str == text) { return true; } } return false; })); }
public virtual bool SetPropertyValue(string propertyName, object value) { return TizenAppium.RunOnMainThread<bool>(() => { var property = Control?.GetType().GetProperty(propertyName); if (property == null) { Log.Debug(Id + " element does not have " + propertyName + " property."); return false; } try { var valueType = property.GetValue(Control).GetType(); var convertedValue = Convert.ChangeType(value, valueType); property.SetValue(Control, convertedValue); } catch (Exception e) { Log.Debug(e.ToString()); return false; } return true; }); }
public static void Terminate() { if (_isInitialized) { TizenAppium.Stop(); _isInitialized = false; } }
public virtual object GetPropertyValue(string propertyName) { return TizenAppium.RunOnMainThread<object>(() => { var value = Control?.GetType().GetProperty(propertyName)?.GetValue(Control); return value; }); }
public static void Initialize() { if (!_isInitialized) { ScreenWidth = Utils.GetScreeenWidth(); ScreenHeight = Utils.GetScreenHeight(); TizenAppium.Start(new NUIAdapter()); _isInitialized = true; } }
public virtual bool ContainsText(string text) { return TizenAppium.RunOnMainThread<bool>(() => { foreach (var prop in DisplayedTextProperies) { var textValue = Control?.GetType().GetProperty(prop)?.GetValue(Control)?.ToString(); if (!string.IsNullOrEmpty(textValue)) { if (textValue.Equals(text)) { return true; } } } return false; }); }