public void CallFunction(string functionName, object[] arguments, string type, SeleniumCommandArguments search, TimeSpan timeout) { NewPopupWindowHandler popupHandler = new NewPopupWindowHandler(webDriver); PreCheckCurrentWindowHandle(); if (string.IsNullOrEmpty(search.IFrameSearch?.Value) == false) { webDriver.SwitchTo().Frame(FindElement(search.IFrameSearch.Value, search.IFrameBy.Value, timeout)); } IWebElement element = FindElement(search.Search.Value, search.By.Value, timeout); element?.CallFunction(functionName, arguments, type); if (string.IsNullOrEmpty(search.IFrameSearch?.Value) == false) { webDriver.SwitchTo().DefaultContent(); } popupHandler.Finish(); }