我想知道是否可以让Webinator使用我已经使用selenium打开的浏览器窗口。因为现在我需要创建一个新实例(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");
答案 0 :(得分:0)