예제 #1
0
        public override void ElementRun(IRootElement root, IWebBrowser browser, ITestElement control)
        {
            ITestElement td;

            if (!String.IsNullOrEmpty(Name))
            {
                String xPath = $".//tr/td[contains(@class, 'prop-name')][normalize-space()={Name.XPathText()}]/../td[contains(@class, 'prop-value')]";
                td = control.GetElementByXPath(xPath);
            }
            else
            {
                String xPath = $".//tr";
                var    rows  = control.GetElementsByXPath(xPath);
                if (Index < 0 || Index >= rows.Count)
                {
                    throw new TestException($"Index was outside the bounds of the array. (Index={Index}, Rows={rows.Count})");
                }
                var row = rows[Index];
                td = row.GetElementByXPath("./td[contains(@class, 'prop-value')]");
            }
            if (td.Text != Value)
            {
                throw new TestException($"Invalid property grid value. Actual:'{td.Text}', expected: '{Value}'");
            }
        }