public WebElementDefinition() { ReturnsCollection = false; AlternativeFindBys = new WebElementLocator[] { }; HtmlTag = ""; AllHtmlTagProperties = new WebElementHtmlAttributes(); }
public WebElementDefinition() { ReturnsCollection = false; AlternativeFindBys = new WebElementLocator[] { }; HtmlTag = ""; AllHtmlTagProperties = new WebElementHtmlAttributes(); }
public void UpdateWebElementWithAdditionalProperties(WebElementDefinition element) { var by = SwdBrowser.ConvertLocatorSearchMethodToBy(element.HowToSearch, element.Locator); var attributes = new Dictionary <string, string>(); try { attributes = SwdBrowser.ReadElementAttributes(by); } catch (Exception e) { string errorMsg = string.Format( "UpdateWebElementWithAdditionalProperties:\n" + "Failed to find element: How={0}; Locator={1}\n" + "With exception:\n {2}" , element.HowToSearch.ToString() , element.Locator.ToString() , e.Message ); MyLog.Error(errorMsg); } if (attributes.Count == 0) { return; } element.HtmlTag = attributes["TagName"]; attributes.Remove("TagName"); WebElementHtmlAttributes elementAttrs = new WebElementHtmlAttributes(); foreach (var attrKey in attributes.Keys) { elementAttrs.Add(attrKey, attributes[attrKey]); } element.AllHtmlTagProperties = elementAttrs; }
public void UpdateWebElementWithAdditionalProperties(WebElementDefinition element) { var by = Utils.ByFromLocatorSearchMethod(element.HowToSearch, element.Locator); var attributes = SwdBrowser.ReadElementAttributes(by); if (attributes.Count == 0) { return; } element.HtmlTag = attributes["TagName"]; attributes.Remove("TagName"); WebElementHtmlAttributes elementAttrs = new WebElementHtmlAttributes(); foreach (var attrKey in attributes.Keys) { elementAttrs.Add(attrKey, attributes[attrKey]); } element.AllHtmlTagProperties = elementAttrs; }