我在网上有一个带Double值列表的下拉菜单,我必须将WebElement
转换为double
,以便可以将其与输入值(即(25556.362))进行比较,然后选择特定的值。
答案 0 :(得分:0)
我将直接使用下面的xpath使用xpath选择选择列表选项。
//select[@attribute='attribute_value']/option[normalize-space(.)='25556.362']
请确保根据选择元素定位符替换上述xpath中的attribute
和attribute_value
。
WebElement selectItem = driver.findElement(By.xpath("//select[@attribute='attribute_value']/option[normalize-space(.)='25556.362']"));
// now click on the element to select
selectItem.click();