POM with Selenium.Support.UI and DropDown Menus

Answered

Hi,

I read the article of “DropDown & Multiple Select Operations in C#” in ToolsQA web site. It explains fine about using SelectElement type of Selenium.Support.UI class

But couldn’t figure out how to use is in a Page Object Model. In the page I use

 

[CacheLookup]

[FindsBy(How = How.CssSelector, Using = "#pie_register > li:nth-child(3) > div > div.radio_wrap > input:nth-child(6)")]

public IWebElement CricketCheckBox { get; set; }

style definitions. And initializing the elements on a Pages class with the driver. My page does not have direct access to driver.

Can anyone give me an idea how to fix the problem?

Regards

 

Add Comment
  • 1 Answer(s)
    Best answer

    Found the solution myself. And wanted to share here as the community may need.

    Thanks

    
    [CacheLookup]
    
    [FindsBy(How = How.Name, Using = "dropdown_7")]
    
    public IWebElement CountrySelect { get; set; }
    
    public SelectElement SelectCountry
    
    {
    
    get { return new SelectElement(CountrySelect); }
    
    }
     
    SelectCountry.SelectByText("Turkey");
    
    
    Default Answered on May 24, 2018.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.