예제 #1
0
        private bool TrySetWithRemoteInterface(IWebElement webElement, string value)
        {
            var remoteWebDriver = webElement.GetWebDriver();

            if (ChromeRemoteInterface.IsSupported(remoteWebDriver) == false)
            {
                return(false);
            }

            if (chromeremoteInterface == null)
            {
                chromeremoteInterface = new ChromeRemoteInterface(remoteWebDriver);
            }
            chromeremoteInterface.SetFileInputFiles(webElement, new [] { value });
            return(true);
        }
예제 #2
0
        public void DownloadFileWith(Action action, Action <string> downloadCallback = null, int downloadTimeoutInSeconds = 60)
        {
            if (ChromeRemoteInterface.IsSupported(this.Driver))
            {
                new ChromeRemoteInterface(this.Driver).TryEnableFileDownloading(this.downloaDirectory.Path);
            }
            this.downloaDirectory.Clear();
            action();
            Driver.WaitUntil(downloadTimeoutInSeconds, (d) =>
            {
                var files = this.downloaDirectory.GetFiles();
                return(files.Length > 0 && files.Any(FileExtensions.IsFileLocked) == false);
            });
            var downloadedFile = this.downloaDirectory.GetFiles().First();

            downloadCallback?.Invoke(downloadedFile);
        }