Note : For the dropdown , HTML page should have <select> and <option> tag .


Solution :

As part of answer, to find element <> , Best xapth is this:

//div[@id='make-select']//button/div/*

Approach to Select Car :

For select car from the dropdown, you can use tradition way to select your element :

Step 1 : Click on dropdown first :

driver.findElement(By.id("make-select")).click();

Step 2 : Select Car from the dropw down. Just pass your car name as parameter :

String strCar = "Nissan"; 

driver.findElement(By.xpath("//div[@itemprop='itemListElement']//div[text()='"+strCar+"']")).click();

Note : Put some sleep or wait between two click events for flawless script.



Source link https://sqa.stackexchange.com/questions/21950/how-to-select-an-element-from-a--down--inside-svg---us

LEAVE A REPLY

Please enter your comment!
Please enter your name here