-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2365c5
commit 47641ff
Showing
4 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,7 +193,7 @@ let waitFor = waitFor2 "Condition not met in given amount of time. If you want t | |
|
||
//find related | ||
let rec private findElements cssSelector (searchContext : ISearchContext) : IWebElement list = | ||
searchedFor <- (cssSelector, browser.Url) :: searchedFor | ||
if optmizeByDisablingCoverageReport = false then searchedFor <- (cssSelector, browser.Url) :: searchedFor | ||
let findInIFrame () = | ||
let iframes = findByCss "iframe" searchContext.FindElements | ||
if iframes.IsEmpty then | ||
|
@@ -210,10 +210,14 @@ let rec private findElements cssSelector (searchContext : ISearchContext) : IWeb | |
|
||
try | ||
let results = | ||
configuredFinders cssSelector searchContext.FindElements | ||
|> Seq.filter(fun list -> not(list.IsEmpty)) | ||
if (hints.ContainsKey cssSelector) then | ||
let finder = hints.[cssSelector] | ||
seq { yield finder cssSelector searchContext.FindElements } | ||
else | ||
configuredFinders cssSelector searchContext.FindElements | ||
|> Seq.filter(fun list -> not(list.IsEmpty)) | ||
if Seq.isEmpty results then | ||
findInIFrame() | ||
if optimizeBySkippingIFrameCheck then [] else findInIFrame() | ||
else | ||
results |> Seq.head | ||
with | ex -> [] | ||
|
@@ -771,4 +775,12 @@ let addFinder finder = | |
let currentFinders = configuredFinders | ||
configuredFinders <- (fun cssSelector f -> | ||
currentFinders cssSelector f | ||
|> Seq.append (seq { yield finder cssSelector f })) | ||
|> Seq.append (seq { yield finder cssSelector f })) | ||
|
||
//hints | ||
let css selector = hints.[selector] <- findByCss; selector | ||
let xpath selector = hints.[selector] <- findByXpath; selector | ||
let jquery selector = hints.[selector] <- findByJQuery; selector | ||
let label selector = hints.[selector] <- findByLabel; selector | ||
let text selector = hints.[selector] <- findByText; selector | ||
let value selector = hints.[selector] <- findByValue; selector | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sergey-tihon
Collaborator
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,6 @@ let mutable disableSuggestOtherSelectors = false | |
let mutable autoPinBrowserRightOnLaunch = true | ||
let mutable throwIfMoreThanOneElement = false | ||
let mutable configuredFinders = finders.defaultFinders | ||
let mutable writeToSelectWithOptionValue = true | ||
let mutable writeToSelectWithOptionValue = true | ||
let mutable optimizeBySkippingIFrameCheck = false | ||
let mutable optmizeByDisablingCoverageReport = false | ||
This comment has been minimized.
Sorry, something went wrong.
sergey-tihon
Collaborator
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is interesting implementation if
hints
...Could different type of selector have similar
selector
string representation?Something like: