private void CheckFrames(IWebDriver driver) { // Setup our retry options first. var options = new BrowserCommandOptions { RetryAttempts = 1, ExceptionTypes = { typeof(StaleElementReferenceException), typeof(NoSuchFrameException) }, ExceptionAction = null }; var command = new DelegateBrowserCommand <bool>(options, d => { var iframes = GetFrameElements(d); foreach (IWebElement frame in iframes) { var currentFrameId = frame.GetAttribute("id"); driver.WaitUntilAvailable(By.Id(currentFrameId)); d.SwitchTo().Frame(currentFrameId); InjectRecordingScript(); //CheckFrames(driver); //Child Frames } return(true); }); command.Execute(driver); }
public BrowserCommandResult <TResult> Execute <TResult, T1, T2, T3, T4, T5>(BrowserCommandOptions options, Func <IWebDriver, T1, T2, T3, T4, T5, TResult> @delegate, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5) { Browser.Depth++; var command = new DelegateBrowserCommand <T1, T2, T3, T4, T5, TResult>(options, @delegate).Execute(Browser.Driver, p1, p2, p3, p4, p5); Browser.CalculateResults(command); Browser.Depth--; return(command); }
public BrowserCommandResult <TResult> Execute <TResult, T1>(BrowserCommandOptions options, Func <IWebDriver, T1, TResult> @delegate, T1 p1) { Browser.Depth++; var command = new DelegateBrowserCommand <T1, TResult>(options, @delegate).Execute(Browser.Driver, p1); Browser.CalculateResults(command); Browser.Depth--; return(command); }
private void SwitchToContentFrame(IWebDriver driver) { var options = new BrowserCommandOptions { RetryAttempts = 1, ExceptionTypes = { typeof(StaleElementReferenceException), typeof(NoSuchFrameException) }, ExceptionAction = null }; var command = new DelegateBrowserCommand <bool>(options, d => { //wait for the content panel to render driver.WaitUntilAvailable(By.Id("crmContentPanel")); //find the crmContentPanel and find out what the current content frame ID is - then navigate to the current content frame var currentContentFrame = driver.FindElement(By.Id("crmContentPanel")).GetAttribute("currentcontentid"); driver.SwitchTo().Frame(currentContentFrame); return(true); }); }
protected BrowserCommand(BrowserCommandOptions options) { this.Options = options; Trace = new TraceSource(this.Options.TraceSource); }
protected BrowserCommand() { this.Options = BrowserCommandOptions.Default; Trace = new TraceSource(this.Options.TraceSource); }
public DelegateBrowserCommand(BrowserCommandOptions options, Func <IWebDriver, TReturn> @delegate) : base(options) { this.Delegate = @delegate; }