private StubElement StubField(string locator, Options options = null)
        {
            var stubField = new StubElement{Id = Guid.NewGuid().ToString()};
            var fieldXpath = new Html(sessionConfiguration.Browser.UppercaseTagNames).Field(locator, options ?? sessionConfiguration);
            driver.StubAllXPath(fieldXpath, new []{stubField}, browserSession, options ?? sessionConfiguration);

            return stubField;
        }
        private StubElement StubOption(string fieldLocator, string optionLocator, Options options = null)
        {
            var stubSelect = new StubElement { Id = Guid.NewGuid().ToString() };
            var stubOption = new StubElement { Id = Guid.NewGuid().ToString() };
            var selectXpath = new Html(sessionConfiguration.Browser.UppercaseTagNames).Select(fieldLocator, options ?? sessionConfiguration);
            var optionXpath = new Html(sessionConfiguration.Browser.UppercaseTagNames).Option(optionLocator, options ?? sessionConfiguration);
            driver.StubAllXPath(selectXpath, new[] { stubSelect }, browserSession, options ?? sessionConfiguration);
            driver.StubAllXPath(optionXpath, new[] { stubOption }, new SnapshotElementScope(stubSelect, browserSession, options), options ?? sessionConfiguration);

            return stubOption;
        }
Beispiel #3
0
 protected override Func<string, Options, string> GetQuery(Html html)
 {
     return ((locator, options) =>
         {
             if (string.IsNullOrEmpty(text))
             {
                 return Locator;
             }
             else
             {
                 return Locator + XPath.Where(html.IsText(text, options));
             }
         }); 
 }
Beispiel #4
0
 protected override Func<string, Options, string> GetQuery(Html html)
 {
     return html.Fieldset;
 }
Beispiel #5
0
 protected override Func<string, Options, string> GetQuery(Html html)
 {
     return html.Button;
 }
        private StubElement StubButtonToBeClicked(string locator, Options options = null)
        {
            var buttonToBeClicked = new StubElement {Id = Guid.NewGuid().ToString()};
            var buttonXpath = new Html(browserSession.Browser.UppercaseTagNames).Button(locator, options ?? sessionConfiguration);

            driver.StubAllXPath(buttonXpath, new []{buttonToBeClicked}, browserSession, options ?? sessionConfiguration);

            return buttonToBeClicked;
        }
Beispiel #7
0
 protected abstract Func<string, Options, string> GetQuery(Html html);
Beispiel #8
0
 internal override IEnumerable<Element> Find(Options options)
 {
     var html = new Html(Scope.Browser.UppercaseTagNames);
        return Driver.FindAllXPath(GetQuery(html)(Locator, options), Scope, options);
 }
 private StubElement StubLinkToBeClicked(string locator, Options options = null)
 {
     var linkToBeClicked = new StubElement { Id = Guid.NewGuid().ToString() };
     var linkXPath = new Html(sessionConfiguration.Browser.UppercaseTagNames).Link(locator, options ?? sessionConfiguration);
     driver.StubAllXPath(linkXPath, new[]{linkToBeClicked}, browserSession, options ?? sessionConfiguration);
     return linkToBeClicked;
 }