<svg viewBox="0 0 24 24" style="display: inline-block; fill: rgb(224, 224, 224); height: 24px; width: 24px; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; position: absolute; right: 0px; top: 14px; -webkit-user-select: none;"><path d="M7 10l5 5 5-5z"></path></svg>
You can find the page at: apply.autogravity.com. The page doesn't use the typical 'select' element found on other websites. Any help would be great.
-
FYI: I've attempted using the select method and can't capture anything. I've also attempted the container option, but i can't capture anything since, the drop down options are not inside the svg view box element. I can only get so far as to click the drop down arrow, but i cannot get it to hover to any value as well.Punns– Punns2016年08月08日 19:32:21 +00:00Commented Aug 8, 2016 at 19:32
-
1where is your code? what exception(s) did you get?Yu Zhang– Yu Zhang2016年08月08日 21:44:05 +00:00Commented Aug 8, 2016 at 21:44
-
I don't get exception, it just cannot find the elements. Here is a sample: Actions move = new Actions(instance); move.moveToElement(di().findElement(By.("Honda"))).click().build(); this is my move mouse to methodPunns– Punns2016年08月08日 23:56:55 +00:00Commented Aug 8, 2016 at 23:56
-
The dropdown names like 'Honda' are being saved as 'div' elements. i attempted to read the page source and find the div, but it doesn't find it eitherPunns– Punns2016年08月09日 00:03:17 +00:00Commented Aug 9, 2016 at 0:03
-
Pls accept the most helpful answer, So question will not be in Active queue for longNarendra Chandratre– Narendra Chandratre2017年01月06日 13:04:40 +00:00Commented Jan 6, 2017 at 13:04
2 Answers 2
Note : For the select dropdown , HTML page should have
<select>
and<option>
tag element.
Solution :
As part of answer, to find element <svg>
, 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.
Solution:
WebElement listbox_webelement =
drive.findElement(By.xpath("write_your_xpath_of_element"));
listbox_webelement.click() [ Expected to list get visible ]
Select select = new Select(listbox_webelement);
select.sendKeys("Text_From_Your_Listbox");
OR
listbox_webelement.sendKeys("Text_From_Your_Listbox");
Explore related questions
See similar questions with these tags.