0

セレンを使用して既に開いているブラウザウィンドウをWebinatorに使用させることができるかどうか疑問に思いました。新しいinstance(config)を作成する必要があり、これにより別のブラウザウィンドウが開くためです。

私のコードはもっと説明できると思います。

        var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
        wait.Until(d => { return d.FindElement(By.Id("mainContentPlaceholder_Wizard1_ButtonCSV")).Displayed; });
        driver.FindElement(By.Id("mainContentPlaceholder_Wizard1_ButtonCSV")).Click();
        var config = new Config
        {
            LogScreenshots = true,
            LogLevel = Config.AvailableLogLevels.Verbose,
            BaseUrl = driver.Url,
            Browser = Config.AvailableBrowsers.FirefoxPlugins,
            Framework = Config.AvailableFrameworks.WebDriver,

        };
        // new instance so new browser window opens 
        var web = WebManagerFactory.CreateInstance(config);
        var fileUpload = LocateBy.Attributes(ByAttribute.Name("ctl00$mainContentPlaceholder$Wizard1$AsyncFileUploadCsv$ctl02"));

        web.Click(fileUpload, WaitUntil.DialogAppears("File Upload"));
        web.Dialog.SelectFiles(Comparison.Contains, "File Upload", @"C:\Users\bram\Desktop", "test2.csv");
4

1 に答える 1

0

いいえ。

これは、Seleniumプロジェクトに対して提起された問題の中で最も古く、最も求められているものの1つです。

https://code.google.com/p/selenium/issues/detail?id=18

于 2013-03-19T10:49:47.173 に答える