Open wccyzxy opened 2 months ago
The code to get prop naturalWidth of img element:
naturalWidth
let question_img = question_img_div.find(By::Css("img")).await?; let origin_width= question_img.prop("naturalWidth").await?;
The error is:
Error: Json("Unexpected value for property: Number(450)")
Goto the code of prop function:
pub async fn prop(&self, name: impl Into<String>) -> WebDriverResult<Option<String>> { let resp = self .handle .cmd(Command::GetElementProperty(self.element_id.clone(), name.into())) .await?; match resp.value()? { Value::String(v) => Ok(Some(v)), Value::Bool(b) => Ok(Some(b.to_string())), Value::Null => Ok(None), v => Err(WebDriverError::Json(format!("Unexpected value for property: {:?}", v))), } }
It's not consider Number type. It's a bug? or the way to use is not correct?
Number
The code to get prop
naturalWidth
of img element:The error is:
Goto the code of prop function:
It's not consider
Number
type. It's a bug? or the way to use is not correct?