lefthandedgoat / canopy

f# web automation and testing library, built on top of Selenium (friendly to c# also)
http://lefthandedgoat.github.io/canopy/
MIT License
507 stars 115 forks source link

NullReferenceException from Canopy #404

Closed haf closed 6 years ago

haf commented 6 years ago

https://github.com/lefthandedgoat/canopy/blob/master/src/canopy/canopy.fs#L192

System.NullReferenceException: Object reference not set to an instance of an object.
   at canopy.core.suggestOtherSelectors$cont@192(String cssSelector, Unit unitVar) in C:\projects\canopy\src\canopy\canopy.fs:line 192
   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 273
   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 EndToEndTests.Program.tests@25-1.Invoke(Unit unitVar0) in C:\dev\tradera\EndToEndTests\Program.fs:line 26
   at Expecto.Impl.execTestAsync@874-1.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@839.Invoke(AsyncParams`1 args)

Repro:

        ftestCase "create a new draft" <| fun () ->
            start firefox
            url "https://tradera.com"
            someElement "button[aria-label='Meny']" |> Option.iter click
            click "a[aria-label='Skapa annons']"
lefthandedgoat commented 6 years ago

Thanks! I will get this fixed for you on Friday.

haf commented 6 years ago

No rush =). Thanks for the awesome library.

lefthandedgoat commented 6 years ago

I wasn't able to reproduce this, but given then stacktrace I put fixes in for the two places that may have a null ref. You can download the latest package here:

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

Thanks haf!