use crate::{Html, Selector}; #[test] fn tag_with_newline() { let selector = Selector::parse("a").unwrap(); let document = Html::parse_fragment( r#" "#, ); let mut iter = document.select(&selector); let a = iter.next().unwrap(); assert_eq!( a.value().attr("href"), Some("https://github.com/causal-agent/scraper") ); } #[test] fn has_selector() { let document = Html::parse_fragment( r#"
Hi There!
"#, ); let selector = Selector::parse("div:has(div#foo) + ul > li:nth-child(2)").unwrap(); let mut iter = document.select(&selector); let li = iter.next().unwrap(); assert_eq!(li.inner_html(), "second"); }