简体   繁体   English

如何将 Webelement 转换为 Double?

[英]How to Convert Webelement to Double?

我在 web 中有一个下拉列表,其中包含一个 Double 值列表,我必须将该WebElement转换为一个double以便我可以将它与我的输入值(即 (25556.362) 进行比较,并选择该特定值。

I would select the select list option using the xpath directly using the below xpath.我会直接使用下面的 xpath 使用 xpath 选择选择列表选项。

//select[@attribute='attribute_value']/option[normalize-space(.)='25556.362']

Make sure to replace the attribute and attribute_value in the above xpath based on the select element locator.确保根据select元素定位器替换上述xpath中的attributeattribute_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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM