C# 如何在运行时将TextBox值加载并保存到应用程序配置文件

C# 如何在运行时将TextBox值加载并保存到应用程序配置文件,c#,selenium-webdriver,C#,Selenium Webdriver,我正在处理一个集成测试应用程序,在此应用程序中,我们必须生成一个客户帐号。现在,此帐号必须在运行时保存在应用程序配置文件中,但是,当您再次运行应用程序时,必须加载配置文件并获取保存的最后一个值,然后从中继续。到目前为止,这就是我所做的,欢迎任何帮助 //Clear the text box IWebElement UPC = _driver.FindElement(By.Id("Details_tbxaccount")); //load the configuration file stri

我正在处理一个集成测试应用程序,在此应用程序中,我们必须生成一个客户帐号。现在,此帐号必须在运行时保存在应用程序配置文件中,但是,当您再次运行应用程序时,必须加载配置文件并获取保存的最后一个值,然后从中继续。到目前为止,这就是我所做的,欢迎任何帮助

 //Clear the text box
IWebElement UPC = _driver.FindElement(By.Id("Details_tbxaccount")); 
//load the configuration file string 
bool IsValid = false; 
int start = 1; 
MyId = null; 
IWebElement UPCTxt ; 
while (!IsValid) 
{ 
     UPC.Clear(); 
     MyId = start.ToString().PadLeft(13,'0'); 
     UPCTxt =_driver.FindElement(By.Id("Details_tbxaccount"));  
     UPCTxt.SendKeys(MyId); 
     if (_driver.FindElement(By.Id("UniqueMessage")).Text.Contains("The Account Number you have entered already exists")) 
     { 
         start++; 
     } 
     else 
     {
         IsValid = true; 
     } 
 } //save the configuration file