I’m trying to make simple test to register in website – https://www.midomi.com/. I’m using c# and but have stuck in values from dropdown using Page object model. My project contains test class and page object folder with two classes inside her – home page and register page.

Register page: here I’m having problem to implement code to selecting values from dropdown list

namespace MidomiRegisterPOM.PageObject
class RegisterPage
    private IWebDriver driver;

    //type your email
    [FindsBy(How = How.Id, Using = "email")]
    public IWebElement Email { get; set; }

    //type your username
    [FindsBy(How = How.Id, Using = "username")]
    public IWebElement UserName { get; set; }

    //type your password
    [FindsBy(How = How.Id, Using = "password")]
    public IWebElement Password { get; set; }

    //confirm your password
    [FindsBy(How = How.Id, Using = "confirm_password")]
    public IWebElement ConfirmPassword { get; set; }

    //here select from dropdown list your birth day, month and year       

    //mark privacy notice checkbox
    [FindsBy(How = How.Id, Using = "tos_pp")]
    public IWebElement PrivacyNotice { get; set; }

    //click Continue button
    [FindsBy(How = How.Id, Using = "submitLink")]
    public IWebElement ContinueButton { get; set; }

    public RegisterPage(IWebDriver driver)
        this.driver = driver;
        PageFactory.InitElements(driver, this);
    public void RegisterToSite()
        Email.SendKeys("[email protected]");

I’m trying this but got error:
enter image description here

Is there any way to select it with [FindsBy] like I’m selecting email, username and password field? Thanks

Here is my code without using :

    var birthMonth = driver.FindElement(By.Id("birth_month"));
    var selectMonth = new SelectElement(birthMonth);

Source link https://sqa.stackexchange.com/questions/34396/selecting--value-from--down-list-with-selenium-using-pom


Please enter your comment!
Please enter your name here