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

Don't use the XPath types, some expressions cannot be expressed by the library still #8

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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