diff --git a/src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs b/src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs index 41cd0b521..a55e39502 100644 --- a/src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs +++ b/src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs @@ -176,6 +176,7 @@ public static bool IsLocked(IExecuteMethod executeMethod) => public static void Unlock(IExecuteMethod executeMethod) => executeMethod.Execute(AppiumDriverCommand.UnlockDevice); + [Obsolete("The ReplaceValue method is deprecated and will be removed in future versions. Please use the following command extensions: 'mobile: replaceElementValue' instead \r\n See https://github.com/appium/appium-uiautomator2-driver#mobile-replaceelementvalue")] public static void ReplaceValue(IExecuteMethod executeMethod, string elementId, string value) => executeMethod.Execute(AppiumDriverCommand.ReplaceValue, new Dictionary() diff --git a/src/Appium.Net/Appium/AppiumCommand.cs b/src/Appium.Net/Appium/AppiumCommand.cs index ab58f6135..6ce1780a0 100644 --- a/src/Appium.Net/Appium/AppiumCommand.cs +++ b/src/Appium.Net/Appium/AppiumCommand.cs @@ -199,14 +199,14 @@ public class AppiumCommand #endregion Input Method (IME) - #region Input value + #region (Deprecated) Input value new AppiumCommand(HttpCommandInfo.PostCommand, AppiumDriverCommand.ReplaceValue, "/session/{sessionId}/appium/element/{id}/replace_value"), new AppiumCommand(HttpCommandInfo.PostCommand, AppiumDriverCommand.SetValue, "/session/{sessionId}/appium/element/{id}/value"), - #endregion Input value + #endregion (Deprecated) Input value #region SeassionData diff --git a/src/Appium.Net/Appium/AppiumDriverCommand.cs b/src/Appium.Net/Appium/AppiumDriverCommand.cs index 2d62ccd66..a29efd031 100644 --- a/src/Appium.Net/Appium/AppiumDriverCommand.cs +++ b/src/Appium.Net/Appium/AppiumDriverCommand.cs @@ -353,11 +353,14 @@ public class AppiumDriverCommand /// public const string FingerPrint = "fingerPrint"; + #region (Deprecated) Input value public const string ReplaceValue = "replaceValue"; public const string SetValue = "setValue"; + #endregion (Deprecated) Input value + public const string GetDeviceTime = "getDeviceTime"; public const string GetSession = "getSession"; diff --git a/src/Appium.Net/Appium/AppiumElement.cs b/src/Appium.Net/Appium/AppiumElement.cs index 950010121..b2142c1ec 100644 --- a/src/Appium.Net/Appium/AppiumElement.cs +++ b/src/Appium.Net/Appium/AppiumElement.cs @@ -200,9 +200,11 @@ public void Rotate(Dictionary opts) #endregion + [Obsolete("The SetImmediateValue method is deprecated and will be removed in future versions. Please use 'SendKeys' instead.")] public void SetImmediateValue(string value) => Execute(AppiumDriverCommand.SetValue, new Dictionary() { ["id"] = Id, ["value"] = value }); + [Obsolete("The ReplaceValue method is deprecated and will be removed in future versions. Please use the following command extensions: 'mobile: replaceElementValue' instead \r\n See https://github.com/appium/appium-uiautomator2-driver#mobile-replaceelementvalue")] public void ReplaceValue(string value) => Execute(AppiumDriverCommand.ReplaceValue, new Dictionary() { ["id"] = Id, ["value"] = value }); diff --git a/src/Appium.Net/Appium/Tizen/TizenCommandExecutionHelper.cs b/src/Appium.Net/Appium/Tizen/TizenCommandExecutionHelper.cs index a0b20a237..2296e1674 100644 --- a/src/Appium.Net/Appium/Tizen/TizenCommandExecutionHelper.cs +++ b/src/Appium.Net/Appium/Tizen/TizenCommandExecutionHelper.cs @@ -13,12 +13,14 @@ //limitations under the License. using OpenQA.Selenium.Appium.Interfaces; +using System; using System.Collections.Generic; namespace OpenQA.Selenium.Appium.Tizen { public sealed class TizenCommandExecutionHelper : AppiumCommandExecutionHelper { + [Obsolete("The ReplaceValue method is deprecated and will be removed in future versions. Please use the following command extensions: 'mobile: replaceElementValue' instead \r\n See https://github.com/appium/appium-uiautomator2-driver#mobile-replaceelementvalue")] public static void ReplaceValue(IExecuteMethod executeMethod, string elementId, string value) => executeMethod.Execute(AppiumDriverCommand.ReplaceValue, new Dictionary() diff --git a/test/integration/Android/ElementTest.cs b/test/integration/Android/ElementTest.cs index b704b5a56..6def99322 100644 --- a/test/integration/Android/ElementTest.cs +++ b/test/integration/Android/ElementTest.cs @@ -4,6 +4,7 @@ using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Appium.Android.UiAutomator; +using System.Collections.Generic; namespace Appium.Net.Integration.Tests.Android { @@ -96,25 +97,12 @@ public void ReplaceValueTest() Assert.AreEqual(originalValue, editElement.Text); - editElement.ReplaceValue(replacedValue); + _driver.ExecuteScript("mobile: replaceElementValue", + new Dictionary { { "elementId", editElement.Id } , { "text", replacedValue } }); Assert.AreEqual(replacedValue, editElement.Text); } - [Test] - public void SetImmediateValueTest() - { - var value = "new value"; - - _driver.StartActivity("io.appium.android.apis", ".view.Controls1"); - - var editElement = - _driver.FindElement(MobileBy.AndroidUIAutomator("resourceId(\"io.appium.android.apis:id/edit\")")); - - editElement.SetImmediateValue(value); - - Assert.AreEqual(value, editElement.Text); - } [Test] public void ScrollingToSubElement() diff --git a/test/integration/IOS/ElementTest.cs b/test/integration/IOS/ElementTest.cs index e44bbd724..028c05c49 100644 --- a/test/integration/IOS/ElementTest.cs +++ b/test/integration/IOS/ElementTest.cs @@ -48,12 +48,5 @@ public void FindByByIosUiAutomationTest() 1); } - [Test] - public void SetImmediateValueTest() - { - var slider = _driver.FindElement(MobileBy.ClassName("UIASlider")); - slider.SetImmediateValue("0%"); - Assert.AreEqual("0%", slider.GetAttribute("value")); - } } } \ No newline at end of file