Added property ids and TabToElementByName

This commit is contained in:
dhbrett 2016-06-13 17:04:51 -07:00
Родитель 557396b4b0
Коммит 158e46c9b9
3 изменённых файлов: 150 добавлений и 5 удалений

Просмотреть файл

@ -51,6 +51,119 @@ namespace Microsoft.Edge.A11y
/// </summary>
private void Initialize()
{
//PropertyIds
UI8Mapping.Add(30000, "RuntimeId");
UI8Mapping.Add(30001, "BoundingRectangle");
UI8Mapping.Add(30002, "ProcessId");
UI8Mapping.Add(30003, "ControlType");
UI8Mapping.Add(30004, "LocalizedControlType");
UI8Mapping.Add(30005, "Name");
UI8Mapping.Add(30006, "AcceleratorKey");
UI8Mapping.Add(30007, "AccessKey");
UI8Mapping.Add(30008, "HasKeyboardFocus");
UI8Mapping.Add(30009, "IsKeyboardFocusable");
UI8Mapping.Add(30010, "IsEnabled");
UI8Mapping.Add(30011, "AutomationId");
UI8Mapping.Add(30012, "ClassName");
UI8Mapping.Add(30013, "HelpText");
UI8Mapping.Add(30014, "ClickablePoint");
UI8Mapping.Add(30015, "Culture");
UI8Mapping.Add(30016, "IsControlElement");
UI8Mapping.Add(30017, "IsContentElement");
UI8Mapping.Add(30018, "LabeledBy");
UI8Mapping.Add(30019, "IsPassword");
UI8Mapping.Add(30020, "NativeWindowHandle");
UI8Mapping.Add(30021, "ItemType");
UI8Mapping.Add(30022, "IsOffscreen");
UI8Mapping.Add(30023, "Orientation");
UI8Mapping.Add(30024, "FrameworkId");
UI8Mapping.Add(30025, "IsRequiredForForm");
UI8Mapping.Add(30026, "ItemStatus");
UI8Mapping.Add(30027, "IsDockPatternAvailable");
UI8Mapping.Add(30028, "IsExpandCollapsePatternAvailable");
UI8Mapping.Add(30029, "IsGridItemPatternAvailable");
UI8Mapping.Add(30030, "IsGridPatternAvailable");
UI8Mapping.Add(30031, "IsInvokePatternAvailable");
UI8Mapping.Add(30032, "IsMultipleViewPatternAvailable");
UI8Mapping.Add(30033, "IsRangeValuePatternAvailable");
UI8Mapping.Add(30034, "IsScrollPatternAvailable");
UI8Mapping.Add(30035, "IsScrollItemPatternAvailable");
UI8Mapping.Add(30036, "IsSelectionItemPatternAvailable");
UI8Mapping.Add(30037, "IsSelectionPatternAvailable");
UI8Mapping.Add(30038, "IsTablePatternAvailable");
UI8Mapping.Add(30039, "IsTableItemPatternAvailable");
UI8Mapping.Add(30040, "IsTextPatternAvailable");
UI8Mapping.Add(30041, "IsTogglePatternAvailable");
UI8Mapping.Add(30042, "IsTransformPatternAvailable");
UI8Mapping.Add(30043, "IsValuePatternAvailable");
UI8Mapping.Add(30044, "IsWindowPatternAvailable");
UI8Mapping.Add(30045, "ValueValue");
UI8Mapping.Add(30046, "ValueIsReadOnly");
UI8Mapping.Add(30047, "RangeValueValue");
UI8Mapping.Add(30048, "RangeValueIsReadOnly");
UI8Mapping.Add(30049, "RangeValueMinimum");
UI8Mapping.Add(30050, "RangeValueMaximum");
UI8Mapping.Add(30051, "RangeValueLargeChange");
UI8Mapping.Add(30052, "RangeValueSmallChange");
UI8Mapping.Add(30053, "ScrollHorizontalScrollPercent");
UI8Mapping.Add(30054, "ScrollHorizontalViewSize");
UI8Mapping.Add(30055, "ScrollVerticalScrollPercent");
UI8Mapping.Add(30056, "ScrollVerticalViewSize");
UI8Mapping.Add(30057, "ScrollHorizontallyScrollable");
UI8Mapping.Add(30058, "ScrollVerticallyScrollable");
UI8Mapping.Add(30059, "SelectionSelection");
UI8Mapping.Add(30060, "SelectionCanSelectMultiple");
UI8Mapping.Add(30061, "SelectionIsSelectionRequired");
UI8Mapping.Add(30062, "GridRowCount");
UI8Mapping.Add(30063, "GridColumnCount");
UI8Mapping.Add(30064, "GridItemRow");
UI8Mapping.Add(30065, "GridItemColumn");
UI8Mapping.Add(30066, "GridItemRowSpan");
UI8Mapping.Add(30067, "GridItemColumnSpan");
UI8Mapping.Add(30068, "GridItemContainingGrid");
UI8Mapping.Add(30069, "DockDockPosition");
UI8Mapping.Add(30070, "ExpandCollapseExpandCollapseState");
UI8Mapping.Add(30071, "MultipleViewCurrentView");
UI8Mapping.Add(30072, "MultipleViewSupportedViews");
UI8Mapping.Add(30073, "WindowCanMaximize");
UI8Mapping.Add(30074, "WindowCanMinimize");
UI8Mapping.Add(30075, "WindowWindowVisualState");
UI8Mapping.Add(30076, "WindowWindowInteractionState");
UI8Mapping.Add(30077, "WindowIsModal");
UI8Mapping.Add(30078, "WindowIsTopmost");
UI8Mapping.Add(30079, "SelectionItemIsSelected");
UI8Mapping.Add(30080, "SelectionItemSelectionContainer");
UI8Mapping.Add(30081, "TableRowHeaders");
UI8Mapping.Add(30082, "TableColumnHeaders");
UI8Mapping.Add(30083, "TableRowOrColumnMajor");
UI8Mapping.Add(30084, "TableItemRowHeaderItems");
UI8Mapping.Add(30085, "TableItemColumnHeaderItems");
UI8Mapping.Add(30086, "ToggleToggleState");
UI8Mapping.Add(30087, "TransformCanMove");
UI8Mapping.Add(30088, "TransformCanResize");
UI8Mapping.Add(30089, "TransformCanRotate");
UI8Mapping.Add(30090, "IsLegacyIAccessiblePatternAvailable");
UI8Mapping.Add(30091, "LegacyIAccessibleChildId");
UI8Mapping.Add(30092, "LegacyIAccessibleName");
UI8Mapping.Add(30093, "LegacyIAccessibleValue");
UI8Mapping.Add(30094, "LegacyIAccessibleDescription");
UI8Mapping.Add(30095, "LegacyIAccessibleRole");
UI8Mapping.Add(30096, "LegacyIAccessibleState");
UI8Mapping.Add(30097, "LegacyIAccessibleHelp");
UI8Mapping.Add(30098, "LegacyIAccessibleKeyboardShortcut");
UI8Mapping.Add(30099, "LegacyIAccessibleSelection");
UI8Mapping.Add(30100, "LegacyIAccessibleDefaultAction");
UI8Mapping.Add(30101, "AriaRole");
UI8Mapping.Add(30102, "AriaProperties");
UI8Mapping.Add(30103, "IsDataValidForForm");
UI8Mapping.Add(30104, "ControllerFor");
UI8Mapping.Add(30105, "DescribedBy");
UI8Mapping.Add(30106, "FlowsTo");
UI8Mapping.Add(30107, "ProviderDescription");
UI8Mapping.Add(30108, "IsItemContainerPatternAvailable");
UI8Mapping.Add(30109, "IsVirtualizedItemPatternAvailable");
UI8Mapping.Add(30110, "IsSynchronizedInputPatternAvailable");
//TODO use UIA_ControlTypeIds
//AttributeIds
UI8Mapping.Add(40000, "AnimationStyle");

Двоичные данные
Inspect.exe

Двоичный файл не отображается.

Просмотреть файл

@ -1129,6 +1129,37 @@ namespace Microsoft.Edge.A11y
}
}
/// <summary>
/// Helper method to tab until an element whose name contains the given string
/// reports that it has focus
/// </summary>
/// <param name="parent">The parent of the target element</param>
/// <param name="name">A string which the target element's name will contain</param>
/// <param name="tabId">The id to send tabs to</param>
/// <param name="driver">The WebDriver</param>
/// <returns>true if the element was found, false otherwise</returns>
private static bool TabToElementByName(IUIAutomationElement parent, string name, string tabId, DriverManager driver)
{
var tabs = 0;
var resets = 0;
var element = parent.GetAllDescendents(e => e.CurrentName.Contains(name)).First();
while (!(bool)element.GetCurrentPropertyValue(new ElementConverter().GetElementCodeFromName("HasKeyboardFocus")))
{
driver.SendSpecialKeys(tabId, "Tab");
if (++tabs > 20)
{
Javascript.ClearFocus(driver, 0);
tabs = 0;
resets++;
if (resets > 5)
{
return false;
}
}
}
return true;
}
/// <summary>
/// Check basic keyboard interactions for the video control
/// </summary>
@ -1159,7 +1190,8 @@ namespace Microsoft.Edge.A11y
}
//Case 1: tab to play button and play/pause
driver.SendSpecialKeys(videoId, "TabSpace");
TabToElementByName(elements[0], "Play", videoId, driver);
driver.SendSpecialKeys(videoId, "Space");
if (!WaitForCondition(VideoPlaying))
{
result += "\tVideo was not playing after spacebar on play button\n";
@ -1174,7 +1206,7 @@ namespace Microsoft.Edge.A11y
//Case 2: Volume and mute
Javascript.ClearFocus(driver, 0);
driver.SendTabs(videoId, 6);//tab to volume control//TODO make this more resilient to UI changes
TabToElementByName(elements[0], "Mute", videoId, driver);
driver.SendSpecialKeys(videoId, "Enter");//mute
if (!WaitForCondition(VideoMuted))
{
@ -1207,7 +1239,7 @@ namespace Microsoft.Edge.A11y
result += "\tVideo was playing when it shouldn't have been\n";
}
Javascript.ClearFocus(driver, 0);
driver.SendTabs(videoId, 3);//tab to seek
TabToElementByName(elements[0], "Seek", videoId, driver);
initial = GetVideoElapsed();
driver.SendSpecialKeys(videoId, "Arrow_right"); //skip ahead
if (!WaitForCondition(VideoElapsed, initial + 10))
@ -1227,7 +1259,7 @@ namespace Microsoft.Edge.A11y
result += "\tVideo was playing when it shouldn't have been\n";
}
Javascript.ClearFocus(driver, 0);
driver.SendTabs(videoId, 4);//tab to seek
TabToElementByName(elements[0], "Seek", videoId, driver);
initial = GetVideoElapsed();
driver.SendSpecialKeys(videoId, "Arrow_right"); //skip ahead
if (!WaitForCondition(VideoElapsed, initial + 10))
@ -1244,7 +1276,7 @@ namespace Microsoft.Edge.A11y
//Case 6: Full screen
Javascript.ClearFocus(driver, 0);
driver.SendTabs(videoId, 8);//tab to fullscreen
TabToElementByName(elements[0], "Full screen", videoId, driver);
driver.SendSpecialKeys(videoId, "Enter"); //enter fullscreen mode
if (!WaitForCondition(IsVideoFullScreen))
{