How to find xpath for Brand dropdown values for below site


Seems it’s difficult to get xpath for Brand dropdown values as it is mouseover dropdown. Once we move away mouse from that section that dropdown will be gone.
Link copied here :

Please let me know, if you have any idea about this.

Senior Quality Engineer, FTD Systems. USA

Default Asked on December 31, 2014 in Selenium WebDriver.
Add Comment
  • 3 Answer(s)

    Hi Balu,

    I would appreciate if you share some code that you have written.

    I can suggest that you use the Action class to move to the point where you Brand element is. Once you do that put a wait for a few milli seconds, so that the drop down is fully loaded. Then using the Xpath run the click or whatever command that you want to.

    If it doesnt work let us know, we will post some code. But before that send us what you have written till now.


    Professor Answered on December 31, 2014.
    Add Comment


    Really appreciate for your help. Seem’s the problem is the ‘Brand’ hasn’t have Select tag it has div.

    public void selectWatch(){
    Select dp = new Select(driver.findElement(By.xpath(“//*[contains(text(),’Brand’)]”)));
    List<WebElement> list = dp.getOptions(); i
    nt size = list.size();
    for (int i=0;i>size;i++){
    String val = dp.getOptions().get(i).getText();
    System.out.println(val); }

    FAILED: selectWatch Element should have been “select” but was “div”.


    Default Answered on December 31, 2014.
    Add Comment

    Hi Balu,

    Just saw the page source and we cannot handle this using a Select class. The reason, as you mentioned, it doesnot have the select tag. And to be honest the Drop down element in your case is very complex.

    I would suggest that you write a page object for this drop down. This page object would include services like
    – GetProductsByCharacter
    – ClickOnProductCheckBox

    If you need help in that try reading this

    I am saying create a factory because
    1. The element is complex element with lots of sub elements
    2. You would be needing this element a lot and its better to make a class out of it
    3. That way you will encapsulate the complexity of finding the Brand and its inner element and the users will just use your class.

    if you cant get this to work, let me know. I will try some demo code for this, which you can later expand.


    Professor Answered on December 31, 2014.
    Add Comment
  • Your Answer

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