Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from slamdata/xpath-expr
Browse files Browse the repository at this point in the history
Don't use the XPath types, some expressions cannot be expressed by the library still
  • Loading branch information
garyb authored Mar 20, 2019
2 parents 4d9cbe0 + 45c1ca4 commit d17e80a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"purescript-argonaut-core": "^5.0.0",
"purescript-css": "^4.0.0",
"purescript-node-fs-aff": "^6.0.0",
"purescript-run": "^3.0.0",
"purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12"
"purescript-run": "^3.0.0"
}
}
13 changes: 5 additions & 8 deletions src/Lunapark/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module Lunapark.Types where

import Prelude

import CSS.Render as CSSR
import CSS.Selector as CSS
import CSS as CSS
import Control.Alt ((<|>))
import Data.Argonaut.Core (Json)
import Data.Argonaut.Core (Json, jsonEmptyObject, jsonNull) as J
Expand All @@ -25,8 +24,6 @@ import Data.Time.Duration (Milliseconds(..))
import Data.Traversable as F
import Data.Tuple (Tuple(..))
import Data.Variant as V
import Data.XPath.AST as XA
import Data.XPath.Printer (printSelector)
import Foreign.Object as FO
import Node.Encoding as NE
import Node.Path (FilePath)
Expand Down Expand Up @@ -174,7 +171,7 @@ encodeRectangle r = J.encodeJson $ FO.fromFoldable

data Locator
= ByCss CSS.Selector
| ByXPath XA.Selector
| ByXPath String
| ByTagName String
| ByLinkText String
| ByPartialLinkText String
Expand All @@ -189,11 +186,11 @@ encodeLocator ∷ Locator → Json
encodeLocator l = J.encodeJson $ FO.fromFoldable case l of
ByCss sel →
[ Tuple "using" "css selector"
, Tuple "value" $ CSSR.selector sel
, Tuple "value" $ CSS.selector sel
]
ByXPath sel
ByXPath expr
[ Tuple "using" "xpath"
, Tuple "value" $ printSelector sel
, Tuple "value" expr
]
ByLinkText sel →
[ Tuple "using" "link text"
Expand Down

0 comments on commit d17e80a

Please sign in to comment.