本文整理汇总了C#中IWebDriver.Manage方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.Manage方法的具体用法?C# IWebDriver.Manage怎么用?C# IWebDriver.Manage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebDriver
的用法示例。
在下文中一共展示了IWebDriver.Manage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeWebDriver
private static void InitializeWebDriver() {
switch (Configuration.BrowserType) {
case BrowserType.Firefox:
WebDriver = new FirefoxDriver();
break;
case BrowserType.InternetExplorer:
var ieOptions = new InternetExplorerOptions {
EnableNativeEvents = true,
EnablePersistentHover = true,
EnsureCleanSession = true,
UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Dismiss
};
WebDriver = new InternetExplorerDriver("./", ieOptions);
break;
case BrowserType.Chrome:
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("test-type");
WebDriver = new ChromeDriver("./", chromeOptions);
break;
default:
throw new ArgumentException("Unknown browser type is specified!");
}
WebDriver.Manage().Window.Maximize();
WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(Configuration.ImplicitWaitTime));
}
示例2: ExecuteScript
private static void ExecuteScript(IWebDriver wd)
{
try
{
//wd.Manage().Window.Maximize();
//Console.WriteLine("Browser Maximizado");
wd.Navigate().GoToUrl("http://www.minhaseconomias.com.br");
Console.WriteLine("Acessado o Site Minhas Economias");
wd.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
wd.FindElement(By.ClassName("login")).Click();
wd.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Console.WriteLine("Clicado no Botão de 'Entrar'");
wd.FindElement(By.Id("email")).SendKeys("[email protected]");
Console.WriteLine("Digitado o Login (E-mail)");
wd.FindElement(By.Id("senha")).SendKeys("[email protected]");
Console.WriteLine("Digitada a Senha");
wd.FindElement(By.Id("login")).FindElement(By.Name("OK")).Click();
Console.WriteLine("Clicado no botão 'Entrar'");
}
finally
{
wd.Close();
}
}
示例3: DocfxSeedSiteFixture
public DocfxSeedSiteFixture()
{
JObject token = JObject.Parse(File.ReadAllText(ConfigFile));
var folder = (string)token.SelectToken("site");
var port = (int)token.SelectToken("port");
Driver = new FirefoxDriver();
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
Driver.Manage().Window.Maximize();
try
{
var contentTypeProvider = new FileExtensionContentTypeProvider();
// register yaml MIME as OWIN doesn't host it by default.
// http://stackoverflow.com/questions/332129/yaml-mime-type
contentTypeProvider.Mappings[".yml"] = "application/x-yaml";
var fileServerOptions = new FileServerOptions
{
EnableDirectoryBrowsing = true,
FileSystem = new PhysicalFileSystem(folder),
StaticFileOptions =
{
ContentTypeProvider = contentTypeProvider
}
};
Url = $"{RootUrl}:{port}";
WebApp.Start(Url, builder => builder.UseFileServer(fileServerOptions));
}
catch (System.Reflection.TargetInvocationException)
{
Console.WriteLine($"Error serving \"{folder}\" on \"{Url}\", check if the port is already being in use.");
}
}
示例4: InitDriver
public void InitDriver()
{
if (!Directory.Exists(@"P:\LabsDeploymentItems")) throw new Exception(@"Unable to locate P:\LabsDeploymentItems");
switch (Properties.Settings.Default.BROWSER)
{
case BrowserType.Chrome:
WebDriver = new ChromeDriver(driversLocation);
break;
case BrowserType.Ie:
InternetExplorerOptions opts = new InternetExplorerOptions();
opts.EnsureCleanSession = true;
opts.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
WebDriver = new InternetExplorerDriver(driversLocation, opts);
break;
case BrowserType.Firefox:
WebDriver = new FirefoxDriver();
break;
default:
throw new ArgumentException("Invalid BROWSER Setting has been used");
}
WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Properties.Settings.Default.IMPLICIT_WAIT_SECONDS));
WebDriver.Manage().Window.Maximize();
}
示例5: logout
public static void logout(IWebDriver driver)
{
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0));
System.Collections.ObjectModel.ReadOnlyCollection<IWebElement> e = driver.FindElements(By.LinkText("Logout"));
if (e.Count > 0) e.First().Click();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Config.implicitTimeout));
}
示例6: TestInit
public void TestInit()
{
_driver = new FirefoxDriver();
_driver.Manage().Window.Maximize();
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
_driver.Navigate().GoToUrl(Facebook);
}
示例7: HomepageTabsTickle
public void HomepageTabsTickle(Datarow datarow, IWebDriver driver, string url)
{
try
{
driver.Navigate().GoToUrl(url);
Thread.Sleep(0xbb8);
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
driver.FindElement(By.XPath("//body[@id='page-home-index']/div/div[2]/div/ul/li/div/div/a/h2"));
driver.FindElement(By.XPath("//body[@id='page-home-index']/div/div[2]/div/ul/li/div/div/a/h2")).Click();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
driver.FindElement(
By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/h2"));
driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/h2"))
.Click();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/p"));
driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/p"))
.Click();
}
catch (Exception exception)
{
var actual = exception.ToString();
datarow.Newrow("Exception", "Not Expected", actual, "FAIL", driver);
}
}
示例8: DocfxSeedSiteFixture
public DocfxSeedSiteFixture()
{
JObject token = JObject.Parse(File.ReadAllText(ConfigFile));
var folder = (string)token.SelectToken("site");
var port = (int)token.SelectToken("port");
Driver = new FirefoxDriver();
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
Driver.Manage().Window.Maximize();
try
{
var fileServerOptions = new FileServerOptions
{
EnableDirectoryBrowsing = true,
FileSystem = new PhysicalFileSystem(folder),
};
Url = $"{RootUrl}:{port}";
WebApp.Start(Url, builder => builder.UseFileServer(fileServerOptions));
}
catch (System.Reflection.TargetInvocationException)
{
Console.WriteLine($"Error serving \"{folder}\" on \"{Url}\", check if the port is already being in use.");
}
}
示例9: StartupBase
public void StartupBase()
{
driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(Constants.MidleDelay));
driver.Manage().Window.Maximize();
Driver.SetDriver(driver);
}
示例10: Initialize
public void Initialize()
{
_driver = new FirefoxDriver();
_actions = new Actions(_driver);
_driver.Url = "http://www.ramyamlab.com/";
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
_driver.Manage().Window.Maximize();
}
示例11: OptimizeDriver
private static IWebDriver OptimizeDriver(IWebDriver driver)
{
driver.Manage().Window.Maximize();
driver.Manage().Cookies.DeleteAllCookies();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
return driver;
}
示例12: SetUp
public void SetUp()
{
_driver = DriverSetup.Driver;
_driver.Manage().Window.Maximize();
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
_driver.Navigate().GoToUrl(TestConfiguration.ApplicationUrl);
homePage = new HomePage(_driver);
}
示例13: TestBaseInitialize
// Use method to initialize drivers
// driver - Selenium webdriver
// browser- Selenium webdriver wrapped with protractor - for angular files
public static void TestBaseInitialize()
{
browser = new ChromeDriver(ConfigurationManager.AppSettings["ChromeDriverPath"]);
driver = new NgWebDriver(browser);
var timeout = Convert.ToInt32(ConfigurationManager.AppSettings["DriverScriptTimeout"], CultureInfo.InvariantCulture);
driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(timeout));
driver.Manage().Window.Maximize();
}
示例14: ClassInitialize
public void ClassInitialize()
{
launcher.Start();
driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
driver.Manage().Cookies.DeleteAllCookies();
driver.Navigate().GoToUrl("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/#identifier");
}
示例15: Initialize
public static void Initialize()
{
baseUrl = "http://52Projects.dev.mymissionsapp.com";
webDriver = new FirefoxDriver(new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\Firefox.exe"), new FirefoxProfile(), TimeSpan.FromMinutes(defaultTimeout));
//webDriver = new ChromeDriver();
webDriver.Manage().Window.Maximize();
webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(defaultTimeout));
}