'How would call the values in Drop down menu, also how do you select any value in radion button?

I am trying to automate a website wherein we have two fields namely with . test website = testing.todorvachev.com.

  1. Drop down menu - to select country
  2. Radio button. - to select the sex.
[configuration file code]
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Demoproject
    {
        public static class config
        {
            public static string BaseURL = "https://testing.todorvachev.com/";
            public static class Credentials
            {
                public static class Valid
                {
                    public static string UserId = "Useridexample";
                    public static string Password = "asdfvb";
                    public static string username = "Username";
                    public static string address = "abcd";
                    public static string[] Country = {"Australia","Canada","India","Russia","USA"}; // How to declare this field in config class.
                    public static string Zipcode = "019345";
                    public static string Email = "[email protected]";
                    public static string[] Sex = { "Male", "Female" }; //How to declare this radio button in config class.
                    public static string About = "This is a description";
                }
            }
        }
    }
    
    
[Actions class]
    using Demoproject.UI_Elements;
    using OpenQA.Selenium.Support.UI;
    using System;
    
    
    namespace Demoproject
    {
        public static class Action01
        {
            public static void InitializeDriver()
            {
                Driver.driver.Navigate().GoToUrl(config.BaseURL);
            }
    
            public static void fillRegisterForm(string userId, string Password, string username, string address,string Dropdownmenu, string zipcode, string Email, string sex, string About)
            {
                TestScenarios tsPage = new TestScenarios();
                SelectElement objectname = new SelectElement(tsPage.DropDownMenu);   ///used to declare drop down menu
    
                tsPage.Userid.SendKeys(userId);
                tsPage.Password.SendKeys(Password);
                tsPage.Username.SendKeys(username);
                tsPage.Address.SendKeys(address);
                objectname.SelectByText(config.Credentials.Valid.Country[2]);  //declare drop down menu
                tsPage.Zipcode.SendKeys(zipcode);
                tsPage.Email.SendKeys(Email);
                tsPage.About.SendKeys(About);
                tsPage.Submit.Click();
    
    
              
    
            }
        }
    }

Note: Config class contains the details as to what to fill and actions class uses the send keys to actually fill it. I have tried to declare the [drop down menu] and [sex] as a string array in config class, but I am confused how to declare them in actions.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source