private static bool ContainsLocatorWithSearchTypePreference(this IPageMemberCodeEntry pageMemberCodeEntry, ElementSearchTypePreferences preference) { return(pageMemberCodeEntry.Locators.Any(locator => preference == locator.ElementSearchTypePreference)); }
private static string GenerateNameWithoutPrefix(this IPageMemberCodeEntry pageMemberCodeEntry, ElementSearchTypePreferences preference) { return(pageMemberCodeEntry.Locators.First(locator => preference == locator.ElementSearchTypePreference).SearchString.ToPascalCase()); }
public static LocatorDefinition CreateDomLocatorByAttribute(this HtmlNode node, string attributeName, ElementSearchTypePreferences elementSearchTypePreference) { if (!node.Attributes.Contains(attributeName)) { return(null); } var attributeValue = node.Attributes[attributeName].Value; // fixing multi-line strings if (attributeValue.Contains('\r')) { attributeValue = attributeValue.Replace("\r", string.Empty); } if (attributeValue.Contains('\n')) { attributeValue = attributeValue.Replace("\n", string.Empty); } return(new LocatorDefinition { Attribute = FindAnnotationTypes.FindBy, ElementSearchTypePreference = elementSearchTypePreference, SearchString = attributeValue }); }