Skip to content
Merged
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
32 changes: 15 additions & 17 deletions Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2336,25 +2336,23 @@ internal BrowserCommandResult<bool> SetValue(string field, string value, FormCon

private void SetInputValue(IWebDriver driver, IWebElement input, string value, TimeSpan? thinktime = null)
{
driver.WaitForTransaction();
input.SendKeys(Keys.Control + "a");
input.SendKeys(Keys.Control + "a");
input.SendKeys(Keys.Backspace);
driver.WaitForTransaction();

if (string.IsNullOrWhiteSpace(value))
{
input.Click(true);
return;
}

if (string.IsNullOrEmpty(value))
// Repeat set value if expected value is not set
// Do this to ensure that the static placeholder '---' is removed
driver.RepeatUntil(() =>
{
input.Click(true);
return;
}
input.Clear();
input.Click();
input.SendKeys(Keys.Control + "a");
input.SendKeys(Keys.Control + "a");
input.SendKeys(Keys.Backspace);
input.SendKeys(value);
driver.WaitForTransaction();
},
d => input.GetAttribute("value").IsValueEqualsTo(value),
TimeSpan.FromSeconds(9), 3,
failureCallback: () => throw new InvalidOperationException($"Timeout after 10 seconds. Expected: {value}. Actual: {input.GetAttribute("value")}")
);

input.SendKeys(value, true);
driver.WaitForTransaction();
}

Expand Down