本文整理汇总了C#中IWebDriver.Quit方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.Quit方法的具体用法?C# IWebDriver.Quit怎么用?C# IWebDriver.Quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebDriver
的用法示例。
在下文中一共展示了IWebDriver.Quit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Finally
public void Finally(IWebDriver driver, string url, Datarow datarow, string emails)
{
new GeneralLibrary();
try
{
//Footer_TPS footer = new Footer_TPS();
//footer.Footer(driver, , url, datarow);
//Baskets_TPS basket = new Baskets_TPS();
//basket.Basket(driver, datarow);
//links_TPS hom = new links_TPS();
//hom.Links(datarow,driver, url);
//UserJourney_TPS userjour = new UserJourney_TPS();
//userjour.UserJourn(datarow,driver, url);
//Mopay_TPS Mopay = new Mopay_TPS();
//Mopay.Mopay(driver, datarow);
}
catch (Exception e)
{
Console.Write(e);
var ex = e.ToString();
var scree = new Screenshot();
datarow.Newrow("Exception", "Not Expected", ex, "FAIL", driver);
scree.Screenshotfailed(driver);
}
finally
{
var split = url.Split(new[] {' ', ',', '.', '/', '\t'});
foreach (var sr in split)
{
if (split[2] == "m" || split[2] == "www")
{
if (sr != split[3]) continue;
datarow.consolidatedreport(emails);
datarow.Excelsave("Mosite-" + sr + "", driver, emails);
driver.Quit();
break;
}
if (sr != split[2]) continue;
datarow.consolidatedreport(emails);
datarow.Excelsave("Mosite-" + sr + "", driver, emails);
driver.Quit();
break;
}
}
}
示例2: ChromeStartup
public void ChromeStartup()
{
dr = new ChromeDriver();
dr.Manage().Window.Maximize();
dr.Navigate().GoToUrl(url);
dr.Quit();
}
示例3: PasswordlessAuthentication
public void PasswordlessAuthentication()
{
string email = "[email protected]";
_webDriver = new RemoteWebDriver(new Uri("http://localhost:9515"), DesiredCapabilities.Chrome());
_webDriver.Manage().Window.Maximize();
_webDriver.Navigate().GoToUrl("http://dev.icms/Account/Login");
//Enter email address on login page
IWebElement emailLogin = _webDriver.FindElement(By.Id("Email"));
emailLogin.Clear();
emailLogin.SendKeys(email);
IWebElement authenticateButton = _webDriver.FindElement(By.Id("requestauth"));
authenticateButton.Click();
//this should have sent me an email
//Let's pretend we got the email and check the server for the authtoken and plug it into the URL
string token = HttpUtility.UrlEncode(TestUtilities.AuthenticationUtil.GetAuthToken(email));
string goToUrl = string.Format("http://dev.icms/account/authorize/?authtoken={0}&email={1}&returnUrl=%2f", token, email);
_webDriver.Quit();
_webDriver = new RemoteWebDriver(new Uri("http://localhost:9515"), DesiredCapabilities.Chrome());
_webDriver.Navigate().GoToUrl(goToUrl);
//Check DOM to see if we are logged in
IWebElement elem = _webDriver.FindElement(By.CssSelector("h1"));
Assert.IsTrue(elem.Text == "Welcome Admin Development");
}
示例4: OpenGooglePage
public void OpenGooglePage()
{
driver = getDriver(browser);
Console.WriteLine("testing");
driver.Navigate().GoToUrl(pageUrl);
driver.Quit();
}
示例5: SelectCheese
/// <summary>
/// Basic way of selecting options of a select element.
/// </summary>
public void SelectCheese(string url)
{
try
{
_driver = Browser.GetFirefoxDriver();
_driver.Navigate().GoToUrl(url);
IWebElement select = _driver.FindElement(By.TagName("select"));
IList<IWebElement> allOptions = select.FindElements(By.TagName("option"));
foreach (var option in allOptions)
{
System.Console.WriteLine("Value is:" + option.GetAttribute("value"));
option.Click();
}
}
catch (System.InvalidOperationException ex)
{
Console.WriteLine("An Invalid operations exception occured: " + ex.Message);
Debug.WriteLine("An Invalid operations exception occured: " + ex.Message);
}
catch (System.Exception ex)
{
Console.WriteLine("An exception occured: " + ex.Message);
Debug.WriteLine("An exception occured: " + ex.Message);
}
finally
{
_driver.Quit();
}
}
示例6: Mositestart
public void Mositestart(IWebDriver driver)
{
new GeneralLibrary();
try
{
_datarow.Col();
// new Modrophenialive().modrophenialiveproducts(, driver);
new Modropheniaproducts().Product(_datarow, driver);
// new UserJourney().UserJourn(this.datarow,driver);
// new UserData().Userdata(this.datarow,driver);
// new Mopaysite().MoPay(driver, , this.datarow);
}
catch (Exception exception)
{
Console.Write(exception);
var actual = exception.ToString();
var screenshot = new Screenshot();
_datarow.Newrow("Exception", "Not Expected", actual, "FAIL", driver);
screenshot.Screenshotfailed(driver);
}
finally
{
_datarow.Excelsave("MoSiteReport", driver, "[email protected]");
_datarow.Dataflush();
driver.Quit();
}
}
示例7: ChromeTest
public virtual void ChromeTest()
{
if (!NareshScalerSettings.Default.ChromeEnabled)
return;
var driverDir = GetDriverDirectory();
try
{
driver = new ChromeDriver(driverDir);
}
catch (Exception)
{
// Only for master build
var masterLibDir = LocateDir(Directory.GetCurrentDirectory(), "lib");
driver = new ChromeDriver(masterLibDir);
}
driver.Manage().Timeouts().ImplicitlyWait(DefaultTimeOutValue);
try
{
RunSeleniumTests();
driver.Quit();
}
catch (Exception e)
{
RecordError(e);
}
}
示例8: WhereIsMyCheese
public void WhereIsMyCheese(string url)
{
try
{
_driver = Browser.GetFirefoxDriver();
_driver.Navigate().GoToUrl(url);
_driver.FindElement(By.Id("windowOpener")).Click();
_driver.SwitchTo().Window("windowName");
_driver.FindElement(By.Id("CheesyButton")).Click();
_driver.SwitchTo().Alert().Accept();
}
catch (System.Exception ex)
{
Console.WriteLine("An exception occured: " + ex.Message);
Debug.WriteLine("An exception occured: " + ex.Message);
}
finally
{
_driver.Quit();
}
}
示例9: selects_moved_to_single_method
public void selects_moved_to_single_method()
{
var profile = new FirefoxProfile();
var exe = new FirefoxBinary(@"D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
browser = new FirefoxDriver(exe, profile);
wait = new WebDriverWait(browser,TimeSpan.FromSeconds(10));
//browser.Navigate().GoToUrl("http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx");
browser.Navigate().GoToUrl("http://localhost/AJAXDemos/CascadingDropDown/CascadingDropDown.aspx");
wait_on_menu_item(1, "Acura");
select_menu_item(1, "Acura");
wait_on_menu_item(2, "Integra");
select_menu_item(2, "Integra");
wait_on_menu_item(3, "Sea Green");
select_menu_item(3, "Sea Green");
wait.Until(
ExpectedConditions.ElementExists(
By.XPath("//span[@id='ctl00_SampleContent_Label1' and text()='You have chosen a Sea Green Acura Integra. Nice car!']")));
browser.Quit();
}
示例10: Mosite
public void Mosite(IWebDriver driver, Datarow datarow, string urls, string items)
{
var screenshot = new Screenshot();
var strArray = items.Split(new[] {','});
var urlarray = urls.Split(new[] {','});
try
{
foreach (var url in urlarray)
{
foreach (var str in strArray.Where(str => str != null))
{
if (str == "Test All Links in Mosite")
{
datarow.Newrow("", "", "Test All Links in Mosite", "", driver);
var tick = new Tickle();
tick.HomepageTabsTickle(datarow, driver, url);
}
if (str == "Test Footer Links")
{
datarow.Newrow("", "", "Test Footer Links", "", driver);
}
if (str == "Test Basket Functionality")
{
datarow.Newrow("", "", "Test Basket Functionality", "", driver);
}
if (str == "Test Produict Page - Test Add Product to Basket")
{
datarow.Newrow("", "", "Test Produict Page - Test Add Product to Basket", "", driver);
}
if (str == "Test Delete From Basket - Test Product Unavailable")
{
datarow.Newrow("", "", "Test Delete From Basket - Test Product Unavailable", "", driver);
}
if (str == "Test Registration/Login - CheckOut Pages")
{
datarow.Newrow("", "", "Test Registration/Login - CheckOut Pages", "", driver);
}
if (str == "Test Mopay")
{
datarow.Newrow("", "", "Test Mopay", "", driver);
}
}
}
}
catch (Exception)
{
datarow.Newrow("Exception", "", "Exception Not Expected", "FAIL", driver);
screenshot.Screenshotfailed(driver);
}
finally
{
datarow.Excelsave("MoshopConsole", driver, "[email protected]");
screenshot.Screenshotfailed(driver);
driver.Quit();
}
}
示例11: Main
static void Main(string[] args)
{
errstring = "";
w("START");
w(" Initialize variables, set up outfiles");
apppath = curdir();
appname = curname();
xlname = appname + ".xls";
xlpath = apppath + "\\" + xlname;
logname = appname + ".log";
mkdir("results");
curpath = "results\\" + dtstring() + "-" + appname;
webfile = appname + ".html";
mkdir(curpath);
webpath = curpath + "\\" + webfile;
logpath = curpath + "\\" + logname;
w(" Fetch variables from the Excel sheet");
openXL(xlpath);
targetURL = getXLParm("targetURL");
uid = getXLParm("uid");
uname = getXLParm("uname");
pid = getXLParm("pid");
pw = getXLParm("pword");
submitid = getXLParm("submitID");
webfile = getXLParm("webfile");
test = getXLParm("test");
webfile = datestring + "-" + webfile;
closeXL();
//w(" Open browser");
//d = new FirefoxDriver();
d = new ChromeDriver();
w(" Navigate to the login screen");
go (targetURL);
w(" Login");
w(" Run the tests - as indicated in the Excel sheet");
exec(test);
//Close and clean up browser stuff
w("Clean up");
d.Close();
d.Quit();
w("END");
//Output results to web page and display it
writeHTML(webpath);
string webspec = apppath + "/" + webpath;
startIE(webspec);
}
示例12: CatalogTestExplorer
public void CatalogTestExplorer()
{
Logger logger = new Logger("CatalogTestLoggerForExplorer.txt");
explorerDriver = new InternetExplorerDriver(AppDomain.CurrentDomain.BaseDirectory, new InternetExplorerOptions(), new TimeSpan(0, 10, 0));
logger.Log("Start Explorer testing");
CatalogTest(explorerDriver, logger);
logger.Log("Close browser");
logger.Dispose();
if (explorerDriver != null)
explorerDriver.Quit();
}
示例13: CatalogTestFirefox
public void CatalogTestFirefox()
{
Logger logger = new Logger("CatalogTestLoggerForFirefox.txt");
firefoxDriver = new FirefoxDriver();
logger.Log("Start Firefox testing");
CatalogTest(firefoxDriver, logger);
logger.Log("Close browser");
logger.Dispose();
if (firefoxDriver != null)
firefoxDriver.Quit();
}
示例14: CatalogTestChrome
public void CatalogTestChrome()
{
Logger logger = new Logger("CatalogTestLoggerForChrome.txt");
chromeDriver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);
logger.Log("Start Chrome testing");
CatalogTest(chromeDriver, logger);
logger.Log("Close browser");
logger.Dispose();
if (chromeDriver != null)
chromeDriver.Quit();
}
示例15: LogInToMailboxUsingFactory
public void LogInToMailboxUsingFactory()
{
driver = new ChromeDriver(driverPath);
driver.Manage().Window.Maximize();
IWebDriver decorDriver = new Decorator(driver);
decorDriver.Navigate().GoToUrl("https://mail.ru/");
LoginPage lp = new LoginPage(decorDriver);
lp.SetUserNamePassword();
MainPage mp = lp.ClickLoginButton();
Assert.IsTrue(mp.loginEmail.Text.ToLower().Equals(lp.Email));
mp.LogOut();
driver.Quit();
}