コード例 #1
0
        public WebElement ByText(string text, bool exactMatch = true)
        {
            var selector = exactMatch ?
                By.XPath(string.Format("//*[text()=\"{0}\"]", text)) :
                By.XPath(string.Format("//*[contains(text(), \"{0}\")]", text));

            _firstSelector = _firstSelector ?? selector;
            _textSearchData = new TextSearchData { Text = text, ExactMatch = exactMatch };

            return this;
        }
コード例 #2
0
        public WebElement ByText(string text, bool exactMatch = true)
        {
            var selector = exactMatch ?
                           By.XPath(string.Format("//*[text()=\"{0}\"]", text)) :
                           By.XPath(string.Format("//*[contains(text(), \"{0}\")]", text));

            _firstSelector  = _firstSelector ?? selector;
            _textSearchData = new TextSearchData {
                Text = text, ExactMatch = exactMatch
            };

            return(this);
        }