本文整理汇总了C#中OpenQA.Selenium.Firefox.FirefoxDriver.Manage方法的典型用法代码示例。如果您正苦于以下问题:C# FirefoxDriver.Manage方法的具体用法?C# FirefoxDriver.Manage怎么用?C# FirefoxDriver.Manage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Firefox.FirefoxDriver
的用法示例。
在下文中一共展示了FirefoxDriver.Manage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SingUp_TestUser_FindNameInHelloString
public void SingUp_TestUser_FindNameInHelloString()
{
firefox = new FirefoxDriver();
firefox.Navigate().GoToUrl("http://localhost:57336/");
firefox.FindElement(By.Id("register")).Click();
//register page
firefox.FindElement(By.Id("inputFirstName")).SendKeys("testFirstName");
firefox.FindElement(By.Id("inputLastName")).SendKeys("testLastName");
firefox.FindElement(By.Id("inputEmail")).SendKeys("[email protected]");
firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
firefox.FindElement(By.Id("submit")).Click();
firefox.FindElement(By.Id("login")).Click();
//log in page
firefox.FindElement(By.Id("inputEmail")).SendKeys("[email protected]");
firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
firefox.FindElement(By.Id("login")).Click();
firefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
string helloString = firefox.FindElement(By.Id("helloString")).Text;
string result = "Hello, testFirstName testLastName";
//delete test user
firefox.Navigate().GoToUrl("http://localhost:57336/User/UsersProfile");
firefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
firefox.FindElement(By.Id("deleteProfile")).Click();
Assert.IsTrue(result == helloString);
}
示例2: CreateWebDriver
public IWebDriver CreateWebDriver()
{
var driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
return driver;
}
示例3: Main
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.seleniummaster.com/");
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
IWebElement menu = driver.FindElement(By.Id("menubar"));
Actions builder = new Actions(driver);
builder.MoveToElement(menu).Build().Perform();
IList<IWebElement> menuItemsList = menu.FindElements(By.Id("menu"));
char[] delim = { '\r', '\n' };
String[] menuList = menuItemsList[0].Text.Split(delim);
//Query to orderby all the list items
IEnumerable<string> orderedMenuList = menuList.OrderBy(lv_menu => lv_menu).ToList();
//Display the ordered list
foreach (string menuItem in orderedMenuList)
{
if (menuItem.Length > 0)
Console.WriteLine(menuItem);
}
Console.ReadKey();
}
示例4: Main
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.integrationqa.com/");
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
IWebElement menu = driver.FindElement(By.Id("hs_menu_wrapper_module_13970568219884"));
Actions builder = new Actions(driver);
builder.MoveToElement(menu).Build().Perform();
IList<IWebElement> menuItemsList = menu.FindElements(By.ClassName("hs-menu-item"));
String[] menuItems = new String[menuItemsList.Count];
int i = 0;
foreach (IWebElement menuItem in menuItemsList)
{
menuItems[i++] = menuItem.Text;
}
//Arrange all the list items in alphabetical order
IEnumerable<String> orderedMenuList = menuItems.OrderBy(lv_menu => lv_menu).ToList();
//Display the ordered list
foreach (var menuItem in orderedMenuList)
{
if (menuItem.Length > 0)
Console.WriteLine(menuItem);
}
Console.ReadKey();
}
示例5: CreateWebDriver
public IWebDriver CreateWebDriver()
{
var driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(2000));
driver.Manage().Window.Maximize();
return driver;
}
示例6: CreateWithDefaultProperties
/// <summary>
/// Yahoo overrides standard DOM event methods (i.e. onclick("", ...)) causing webdriver to trigger unexpected memory protection exceptions
/// </summary>
public static IWebDriver CreateWithDefaultProperties()
{
var caps = new OpenQA.Selenium.Remote.DesiredCapabilities();
caps.SetCapability(OpenQA.Selenium.Remote.CapabilityType.HasNativeEvents, false);
var driver = new FirefoxDriver(caps);
driver.Manage().Window.Maximize();
driver.Manage().Cookies.DeleteAllCookies();
return driver;
}
示例7: FirefoxBrowser
public static IWebDriver FirefoxBrowser()
{
IWebDriver driver;
driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
driver.Navigate().GoToUrl(BaseURL);
return driver;
}
示例8: CreateDriver
public override IWebDriver CreateDriver()
{
Console.WriteLine("Create Factory FF WD");
FirefoxProfile profile = new FirefoxProfile();
profile.EnableNativeEvents = true;
profile.DeleteAfterUse = true;
IWebDriver factoryDriver = new FirefoxDriver(profile);
factoryDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
factoryDriver.Manage().Window.Maximize();
return factoryDriver;
}
示例9: SetUp
public void SetUp()
{
IWebDriver driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
browser = new Browser(driver);
}
示例10: Main
static void Main(string[] args)
{
try
{ // Instantiating variables
string[] theURLs = new string[3];
string[] theCriteria = new string[3];
int wi, milsec=2500;
// Instantiating classes
IWebDriver wbDriver = new FirefoxDriver();
TheWebURLs webI=new TheWebURLs();
LoggingStuff logMe = new LoggingStuff();
wbDriver.Manage().Window.Maximize();
// Setting values for variables
theURLs=webI.getTheURLs();
theCriteria=webI.getSearchCiteria();
string logPath = logMe.createLogName().ToString();
/**********************************************/
// Run Test
logMe.writeFile("Selenium Test Log", false, logPath);
for(wi = 0; wi < 3; wi++)
{ // Opens the various web pages
Console.WriteLine(theURLs[wi] + ", " + theCriteria[wi]);
logMe.writeFile(theURLs[wi] + ", " + theCriteria[wi], true, logPath);
wbDriver.Navigate().GoToUrl(theURLs[wi]);
Thread.Sleep(milsec*2);
}
wbDriver.Quit();
}
catch (IOException e3)
{
Console.WriteLine("Failed during Main",e3.Message);
}
}
示例11: Main
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
int idInicio = 30000;
int idFinal = 22000;
int contador = 1;
String url = "";
driver.Navigate().GoToUrl(url + idInicio);
driver.Manage().Window.Maximize();
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"e:\AllStudents.csv", true))
{
while (idInicio > idFinal)
{
driver.Navigate().GoToUrl(url + idInicio);
IWebElement nome = driver.FindElement(By.Id("txtNome"));
IWebElement email = driver.FindElement(By.Id("txtmail_maior"));
if (email.GetAttribute("value").ToString() != "")
{
Console.WriteLine(contador + " - " + idInicio.ToString() + " - " + nome.GetAttribute("value").ToString() + " - " + email.GetAttribute("value").ToString());
file.WriteLine(contador + ";" + idInicio.ToString() + ";" + email.GetAttribute("value").ToString() +";"+ nome.GetAttribute("value").ToString());
contador++;
}
idInicio--;
}
}
}
示例12: Main
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
const int idInicio = 0;
const int idFim = 1000;
int id = idInicio;
String url = "http://fcv.matheusacademico.com.br/Aluno/frmAlunoAlteracao.asp?id=";
driver.Navigate().GoToUrl(url + id);
driver.Manage().Window.Maximize();
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\AllStudents1.txt", true))
{
while (id < idFim)
{
driver.Navigate().GoToUrl(url + id);
IWebElement nome = driver.FindElement(By.Id("txtNome"));
IWebElement email = driver.FindElement(By.Id("txtmail_maior"));
if (nome.GetAttribute("value").ToString() != "")
file.WriteLine(id.ToString() + " - " + nome.GetAttribute("value").ToString() + " - " + email.GetAttribute("value").ToString());
id++;
}
}
}
示例13: PostToBlog
public void PostToBlog()
{
IWebDriver browser = new FirefoxDriver();
browser.Navigate().GoToUrl("http://tumblr.com/login");
IWebElement email = browser.FindElement(By.Id("signup_determine_email"));
email.SendKeys("[email protected]");
IWebElement verifyButton = browser.FindElement(By.Id("signup_forms_submit"));
verifyButton.Click();
browser.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
IWebElement password = browser.FindElement(By.Id("signup_password"));
password.SendKeys("******");
IWebElement loginButton = browser.FindElement(By.Id("signup_forms_submit"));
loginButton.Click();
IWebElement textIcon = browser.FindElement(By.ClassName("icon_post_text"));
textIcon.Click();
IWebElement postTitle = browser.FindElement(By.ClassName("editor-plaintext"));
postTitle.SendKeys("c# selenium");
IWebElement postBody = browser.FindElement(By.ClassName("editor-richtext"));
postBody.SendKeys("this is a c# with selenium test");
IWebElement createPost = browser.FindElement(By.ClassName("create_post_button"));
createPost.Click();
//TearDown
IWebElement postSettings = browser.FindElement(By.ClassName("post_control_menu"));
postSettings.Click();
IWebElement postDelete = browser.FindElement(By.ClassName("delete"));
postDelete.Click();
IWebElement okButton = browser.FindElement(By.ClassName("btn_1"));
okButton.Click();
IWebElement accountButton = browser.FindElement(By.ClassName("icon_user_settings"));
browser.Close();
}
示例14: LogonTest
public void LogonTest()
{
IWebDriver driver = new FirefoxDriver();
//IWebDriver driver = new ChromeDriver();
//IWebDriver driver = new InternetExplorerDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
//ChromeDriver driver = new ChromeDriver();
string homepageURL = "https://localhost:44300/";
IndexPage indexPageObject = new IndexPage(driver);
//open home page
indexPageObject.OpenPage(homepageURL);
//verify the user is not logged in
Assert.IsTrue(indexPageObject.CheckAuthentication(false));
//navigate to login page
LoginPage loginPage = indexPageObject.NavigateToLoginPage();
//enter id and password and login
indexPageObject = loginPage.Login("[email protected]", "F5ft2mz0_");
//verify the user is logged in
Assert.IsTrue(indexPageObject.CheckAuthentication(true));
//driver.Close();
}
示例15: FirefoxStartup
public void FirefoxStartup()
{
FirefoxDriver dr = new FirefoxDriver();
dr.Manage().Window.Maximize();
dr.Navigate().GoToUrl(url);
dr.Quit();
}