I am using selenium with c# to write automated tests for a website. I am still learning selenium and c#, and getting into issues here and there. I am not sure what would be a good approach. Would app.config file in c# be a good idea to store all xpaths of objects in the website? Or is it not a good idea to store hundreds of these object definitions in an xml file like app.config. Also, right now, I have:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Machine" value="localhost"/>
</appSettings>
</configuration>
and, I am using a method in my class to get the values from this app.config file:
public string GetAppConfig(string key)
{
return ConfigurationManager.AppSettings[key].ToString();
}
Is this a good way to retrieve values from app.config. Or is there a better way to do it?
Thanks in advance for your help. I am really confused to as what I should be doing to store xpaths. I do not want to do something like:
Selenium.Click(\\id="...."\)
because that would be difficult to change if the xpaths change in the website later.