@@ 18,6 18,7 @@ import qualified XML.Selectors.CSS as CSS
import Network.URI (parseURIReference)
import Data.Maybe
+import Data.String (fromString)
getTitle :: Session -> IO Text
getTitle session = getTitle' <$> documentRoot <$> document <$> readMVar session
@@ 44,6 45,7 @@ find (Find "css selector" sel) root = case CSS.parsePath sel of
Left msg -> Left (True, msg)
find (Find "link text" sel) root = Right $ allLinks (== pack sel) root
find (Find "partial link text" sel) root = Right $ allLinks (Txt.isInfixOf $ pack sel) root
+find (Find "tag name" sel) root = Right (X.descendant root >>= X.checkName (== fromString sel))
find (Find type_ _) _ = Left (False, "Invalid selector type: " ++ Txt.unpack type_)
allLinks test = X.descendant X.>=>