Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectors don't warn about missing browser instance. #405

Closed
haf opened this issue Feb 28, 2018 · 3 comments
Closed

Selectors don't warn about missing browser instance. #405

haf opened this issue Feb 28, 2018 · 3 comments

Comments

@haf
Copy link

haf commented Feb 28, 2018

If you forget to start the browser you get a strange error message from a selector:

canopy.types+CanopyElementNotFoundException: can't find element button[aria-label='Meny']
   at canopy.core.findByFunction[a,b,c](String cssSelector, a timeout, FSharpFunc`2 waitFunc, b searchContext, Boolean reliable) in C:\projects\canopy\src\canopy\canopy.fs:line 274
   at canopy.core.unreliableElements(String cssSelector) in C:\projects\canopy\src\canopy\canopy.fs:line 307
   at canopy.core.someElement(String cssSelector) in C:\projects\canopy\src\canopy\canopy.fs:line 333
   at [email protected](Unit unitVar0) in C:\dev\tradera\EndToEndTests\Program.fs:line 25
   at [email protected](Unit unitVar)
   at [email protected](AsyncParams`1 args)

@haf haf changed the title someElement throws exception when not found someElement does not need browser Feb 28, 2018
@haf haf changed the title someElement does not need browser Selectors don't warn about missing browser instance. Feb 28, 2018
@lefthandedgoat
Copy link
Owner

I can add some checking for this. Thanks for the feedback!

@lefthandedgoat
Copy link
Owner

New changes make the error message read like this

Can't perform the action because the browser instance is null.  `start chrome` to start a new browser.
Url: no browser = no url
Exception details:
canopy.types+CanopyNoBrowserException: Can't perform the action because the browser instance is null.  `start chrome` to start a new browser.
   at Microsoft.FSharp.Core.Operators.Raise[T](Exception exn)
   at canopy.wait.waitResults[a](Double timeout, FSharpFunc`2 f) in C:\projects\canopy\src\canopy\wait.fs:line 30
   at canopy.wait.wait(Double timeout, FSharpFunc`2 f) in C:\projects\canopy\src\canopy\wait.fs:line 35
   at canopy.core.click[a](a item) in C:\projects\canopy\src\canopy\canopy.fs:line 671
   at [email protected](Unit _arg6) in C:\projects\canopy\tests\basictests\Program.fs:line 76
   at [email protected](Unit x) in C:\projects\canopy\src\canopy\runner.fs:line 161
   at canopy.runner.tryTest[a,b](a test, b suite, FSharpFunc`2 func) in C:\projects\canopy\src\canopy\runner.fs:line 134

@lefthandedgoat
Copy link
Owner

You can download the latest package with improved error messages here:

https://www.nuget.org/packages/canopy/1.6.3

Thanks haf!

@haf haf closed this as completed Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants