简体   繁体   中英

How to use sendkeys in selenium web driver and c# so it generates unique name and account numbers

I am New to automation with no background in programming. I am creating a test case to run in selenium where account number and account name needs to be unique each time. This is what i have.

 string ClientName = "Automation" + new Random();
 driver.FindElement(By.XPath("XXXX")).SendKeys(ClientName);

Found my own answer. Installed Faker-cs-PCL from NuGet Package Manager.

 var ClientName = driver.FindElement(By.XPath("XXXXXXX"));
 var name = Faker.Name.FullName();
 ClientName.SendKeys(name);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM