From d897bc317517104aab16dcc3cfdb16feec62c896 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 26 Feb 2021 00:58:17 +0000 Subject: [PATCH] apitest: Break out HtmlExt::element() Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index bb09c6cb..c1ca5c94 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -35,13 +35,22 @@ mod scraper_ext { fn select<'a,'b>(&'a self, selector: &'b Selector) -> Select<'a, 'b>; #[throws(as Option)] - fn e_attr(&self, sel: S, attr: &str) -> &str + fn element(&self, sel: S) -> ElementRef where S: TryInto, >::Error: Debug, { self .select(&sel.try_into().unwrap()) .next()? + } + + #[throws(as Option)] + fn e_attr(&self, sel: S, attr: &str) -> &str + where S: TryInto, + >::Error: Debug, + { + self + .element(sel).unwrap() .value().attr(attr)? } } -- 2.30.2