Skip to content

Commit

Permalink
IsReadOnly support for additional field types (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
TYLEROL authored Aug 14, 2020
1 parent 7d291f7 commit 109dd14
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion Microsoft.Dynamics365.UIAutomation.Api.UCI/Controls/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using OpenQA.Selenium;
using Microsoft.Dynamics365.UIAutomation.Browser;
using System;

namespace Microsoft.Dynamics365.UIAutomation.Api.UCI
{
Expand Down Expand Up @@ -66,7 +67,31 @@ public bool IsReadOnly
{
var readOnly = containerElement.FindElement(By.XPath(AppElements.Xpath[AppReference.Field.ReadOnly]));

if(readOnly.HasAttribute("readonly"))
if (readOnly.HasAttribute("aria-readonly"))
{
// TwoOption / Text / Lookup Condition
bool isReadOnly = Convert.ToBoolean(readOnly.GetAttribute("aria-readonly"));
if (isReadOnly)
return true;
}
else if (readOnly.HasAttribute("readonly"))
return true;
}
else if (containerElement.HasElement(By.TagName("select")))
{
// Option Set Condition
var readOnlySelect = containerElement.FindElement(By.TagName("select"));

if (readOnlySelect.HasAttribute("disabled"))
return true;

}
else if (containerElement.HasElement(By.TagName("input")))
{
// DateTime condition
var readOnlyInput = containerElement.FindElement(By.TagName("input"));

if (readOnlyInput.HasAttribute("disabled"))
return true;
}

Expand Down

0 comments on commit 109dd14

Please sign in to comment.