Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:28:40+00:00 2026-05-23T05:28:40+00:00

I am using selenium with c# to write automated tests for a website. I

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:28:41+00:00Added an answer on May 23, 2026 at 5:28 am

    Use the built in ConfigurationManager where possible, avoid rolling your own if you don’t need to. You can make this helper class static so it can be called direct without creating a new instance.

    Note that in your code, if the key doesn’t exist it will throw an exception, depending on your requirements you may want to catch it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual Studio 2010 to write Selenium 2 Webdriver automated tests in
I'm using the Selenium Fitnesse Bridge Fixture in order to write tests in Fitnesse
I'm using selenium webdriver to write tests, and the following code returns the error
I'm using Selenium RC to write test cases for a website that's at least
I am using Selenium RC and JUnit to write tests. If a @Test fails,
We've been using selenium with great success to handle high-level website testing (in addition
I'm using selenium to run some functional tests on the UI for our current
I am writing some UI tests using Selenium and i have a JavaScript Tree
I'm building some functional tests for a web site using Selenium, and I'm stuck
We are using JUnit - Selenium for our web tests. We use Maven to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.