|
28 | 28 | using System.Reflection;
|
29 | 29 | using OpenQA.Selenium.Appium.src.Appium.Interfaces;
|
30 | 30 | using System.Diagnostics.Contracts;
|
| 31 | +using Newtonsoft.Json; |
31 | 32 |
|
32 | 33 | namespace OpenQA.Selenium.Appium
|
33 | 34 | {
|
@@ -741,6 +742,40 @@ public void PerformTouchAction(TouchAction touchAction)
|
741 | 742 |
|
742 | 743 | #endregion Multi Actions
|
743 | 744 |
|
| 745 | + #region Settings |
| 746 | + |
| 747 | + /// <summary> |
| 748 | + /// Get appium settings currently set for the session |
| 749 | + /// See: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md |
| 750 | + /// </summary> |
| 751 | + public Dictionary<String, Object> GetSettings() |
| 752 | + { |
| 753 | + var commandResponse = this.Execute(AppiumDriverCommand.GetSettings, null); |
| 754 | + return JsonConvert.DeserializeObject<Dictionary<String, Object>>((String) commandResponse.Value); |
| 755 | + } |
| 756 | + |
| 757 | + /// <summary> |
| 758 | + /// Set "ignoreUnimportantViews" setting. |
| 759 | + /// See: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md |
| 760 | + /// </summary> |
| 761 | + public void IgnoreUnimportantViews(bool value) |
| 762 | + { |
| 763 | + this.UpdateSetting ("ignoreUnimportantViews", value); |
| 764 | + } |
| 765 | + |
| 766 | + /// <summary> |
| 767 | + /// Update an appium Setting, on the session |
| 768 | + /// </summary> |
| 769 | + private void UpdateSetting(String setting, Object value) |
| 770 | + { |
| 771 | + var parameters = new Dictionary<string, object>(); |
| 772 | + var settings = new Dictionary<string, object>(); |
| 773 | + settings.Add(setting, value); |
| 774 | + parameters.Add("settings", settings); |
| 775 | + this.Execute(AppiumDriverCommand.UpdateSettings, parameters); |
| 776 | + } |
| 777 | + #endregion Settings |
| 778 | + |
744 | 779 | #endregion Public Methods
|
745 | 780 |
|
746 | 781 | #region Internal Methods
|
@@ -862,7 +897,9 @@ private static void _AddAppiumCommands()
|
862 | 897 | new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.HideKeyboard, "/session/{sessionId}/appium/device/hide_keyboard"),
|
863 | 898 | new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.OpenNotifications, "/session/{sessionId}/appium/device/open_notifications"),
|
864 | 899 | new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.StartActivity, "/session/{sessionId}/appium/device/start_activity"),
|
865 |
| - #endregion Appium Commands |
| 900 | + new _Commands(CommandInfo.GetCommand, AppiumDriverCommand.GetSettings, "/session/{sessionId}/appium/settings"), |
| 901 | + new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.UpdateSettings, "/session/{sessionId}/appium/settings"), |
| 902 | + #endregion Appium Commands |
866 | 903 | #region Touch Commands
|
867 | 904 | new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.MultiActionV2Perform, "/session/{sessionId}/touch/multi/perform"),
|
868 | 905 | new _Commands(CommandInfo.PostCommand, AppiumDriverCommand.TouchActionV2Perform, "/session/{sessionId}/touch/perform"),
|
|
0 commit comments