Ejemplo n.º 1
0
        public ChromeFullPageLens(RemoteWebDriver driver)
        {
            if (IsSupported(driver) == false)
            {
                throw new Exception("ChromeFullPageLens works only with Chrome version 59 or higher");
            }

            this.driver = driver;
            this.chromeRemoteInterface = new ChromeRemoteInterface(driver);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }