Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object>()
Expand Down
4 changes: 2 additions & 2 deletions src/Appium.Net/Appium/AppiumCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/Appium.Net/Appium/AppiumDriverCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,14 @@ public class AppiumDriverCommand
/// </summary>
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";
Expand Down
2 changes: 2 additions & 0 deletions src/Appium.Net/Appium/AppiumElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ public void Rotate(Dictionary<string, int> 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<string, object>() { ["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<string, object>() { ["id"] = Id, ["value"] = value });

Expand Down
2 changes: 2 additions & 0 deletions src/Appium.Net/Appium/Tizen/TizenCommandExecutionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object>()
Expand Down
18 changes: 3 additions & 15 deletions test/integration/Android/ElementTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -96,25 +97,12 @@ public void ReplaceValueTest()

Assert.AreEqual(originalValue, editElement.Text);

editElement.ReplaceValue(replacedValue);
_driver.ExecuteScript("mobile: replaceElementValue",
new Dictionary<string, string> { { "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()
Expand Down
7 changes: 0 additions & 7 deletions test/integration/IOS/ElementTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
}