public void SetGetValuesFromDOM() { // HtmlControl/Elements now have a generic SetValue/GetValue that allows developers // to set/get values directly from the DOM for any property on the control. Whether it is inherited, // readonly or an emitted attribute. // Get whether a checkbox is enabled or disabled. HtmlInputCheckBox cks = Find.ById <HtmlInputCheckBox>("checkbox1"); bool disabled = cks.GetValue <bool>("disabled"); // Disable it cks.SetValue <string>("disabled", "true"); Assert.IsTrue(cks.GetValue <bool>("disabled")); // Is it visible. IsVisible follows the CSS chain to determine if the // element is actually visible or not. An element is visible when // the CSS the display style is not 'none' and the visibility style // is not 'hidden'. Assert.IsTrue(cks.IsVisible()); // Get the color style HtmlSpan mySpan = Find.ById <HtmlSpan>("Warning"); HtmlStyle styleColor = mySpan.GetStyle("color"); string strColor = mySpan.GetStyleValue("color"); // Getting the computed style will follow the CSS chain and return the // style. HtmlStyle styleMargin = mySpan.GetComputedStyle("margin"); string strMargin = mySpan.GetComputedStyleValue("margin"); }