protected override void ProcessRecord() { CheckInputWebDriverOrWebElement(); var command = new SeGetWebElementCommand(this); command.Execute(); }
protected override void ProcessRecord() { CheckInputWebDriverOrWebElement(); var command = new SeGetWebElementCommand(this); command.Execute(); }
private IWebElement getElement( WebElementsFrom typeFrom, List <IWebElement> listOfElements, FindElementParameters searchType, string searchValue) { GetSeWebElementCommand cmdlet = WebDriverFactory.Container.Resolve <GetSeWebElementCommand>(); cmdlet.Timeout = 1000; switch (searchType) { case FindElementParameters.ById: cmdlet.Id = searchValue; break; case FindElementParameters.ByClassName: cmdlet.ClassName = searchValue; break; case FindElementParameters.ByTagName: cmdlet.TagName = searchValue; break; case FindElementParameters.ByName: cmdlet.Name = searchValue; break; case FindElementParameters.ByLinkText: cmdlet.LinkText = searchValue; break; case FindElementParameters.ByPartialLinkText: cmdlet.PartialLinkText = searchValue; break; case FindElementParameters.ByCss: cmdlet.CssSelector = searchValue; break; case FindElementParameters.ByXPath: cmdlet.XPath = searchValue; break; case FindElementParameters.ByJavaScript: throw new Exception("JS! ... Invalid value for FindElementParameters"); //break; default: throw new Exception("Invalid value for FindElementParameters"); } IWebDriver testDriver = null; IWebElement testElement = null; if (WebElementsFrom.WebDriver == typeFrom) { testDriver = WebDriverFactory.Container.Resolve <FakeWebDriver>(); ((FakeWebDriver)testDriver).SetElementsCollection(listOfElements); cmdlet.InputObject = new object[] { testDriver }; } else if (WebElementsFrom.WebElement == typeFrom) { testElement = WebDriverFactory.Container.ResolveKeyed <FakeWebElement>(Constructors.FakeWebElementNoParameters); ((FakeWebElement)testElement).SetElementsCollection(listOfElements); cmdlet.InputObject = new object[] { testElement }; } SeGetWebElementCommand command = new SeGetWebElementCommand(cmdlet); command.Execute(); return((FakeRemoteWebElement)(object)PSTestLib.UnitTestOutput.LastOutput[0]); }