Skip to content

Commit

Permalink
fix for #210
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Aug 18, 2015
1 parent 40313e9 commit f55bd4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/canopy/finders.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let findByLabel locator f =
| head :: tail when isField head-> [head]
| _ -> []
try
let labels = f(By.XPath(sprintf ".//label[text() = '%s']" locator))
let labels = f(By.XPath(sprintf """.//label[text() = "%s"]""" locator))
if (Seq.isEmpty labels) then
[]
else
Expand All @@ -45,12 +45,12 @@ let findByLabel locator f =

let findByText text f =
try
f(By.XPath(sprintf ".//*[text() = '%s']" text)) |> List.ofSeq
f(By.XPath(sprintf """.//*[text() = "%s"]""" text)) |> List.ofSeq
with | _ -> []

let findByValue value f =
try
findByCss (sprintf "*[value='%s']" value) f |> List.ofSeq
findByCss (sprintf """*[value="%s"]""" value) f |> List.ofSeq
with | _ -> []

//you can use this as an example to how to extend canopy by creating your own set of finders, tweaking the current collection, or adding/removing
Expand Down
4 changes: 4 additions & 0 deletions tests/basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ let testpage = "http://lefthandedgoat.github.io/canopy/testpages/"

"intentionally skipped shows blue in LiveHtmlReport" &&! skipped

"Apostrophes don't break anything" &&& fun _ ->
url testpage
count "I've got an apostrophe" 1

"#welcome should have Welcome" &&& fun _ ->
url testpage
"#welcome" == "Welcome"
Expand Down

0 comments on commit f55bd4b

Please sign in to comment.