mercredi 29 juin 2016

How to get data from console using Unit Test Project

I'm using Selenium WebDriver for C# and want to get username and password from console. My code is:

var username = Console.ReadLine(); 
var password = Console.ReadLine();

// open application
driver.Navigate().GoToUrl("http://myurl");

// enter username and password, press enter
driver.FindElement(By.Id("Username")).SendKeys(username);
driver.FindElement(By.Id("Password")).SendKeys(password);
driver.FindElement(By.Id("Password")).SendKeys(Keys.Enter);

But Console.ReadLine() not working in Unit Test Project.

What is the best way to do it?

1 commentaire: