lefthandedgoat / canopy

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

Not able to execute canopy script on Edge Browser #522

Open RutujaNagare opened 2 years ago

RutujaNagare commented 2 years ago

Describe the bug I am trying to execute canopy script on Edge Browser but my script is not able to execute. Edge browser is opening at the time of execution but the given URL is not entering on browser. So that next flow of test case is not working.

I am using below code to open Edge Browser and entering URL in it, using this code Edge browser is opening but not able to enter URL let OpenEdgeBrowser(givenUrl) = start EdgeBETA pin types.Left
url givenUrl

If I use below code then Edge browser itself is not opening let OpenEdgeBrowser(givenUrl) = browser <- new EdgeDriver() url givenUrl

Also Nuget Package related to Edge browser is installed and a edge driver is also placed at given location in code (C drive) EdgeBrowserIssue

Could you please suggest solution?

lefthandedgoat commented 2 years ago

I downloaded the edge driver from here: https://msedgedriver.azureedge.net/92.0.902.55/edgedriver_win64.zip

Unzip the exe, placed it in c:\ (you can place wherever), renamed to MicrosoftWebDriver.exe and everything worked.

open canopy.runner.classic
open canopy.classic
open canopy.types

canopy.configuration.edgeDir <- @"C:\" // change to where you put your driver

context "something"

//start an instance of chrome
start EdgeBETA

//this is how you define a test
"taking canopy for a spin" &&& fun _ ->
    //this is an F# function body, it's whitespace enforced

    //go to url
    url "http://lefthandedgoat.github.io/canopy/testpages/"

    //assert that the element with an id of 'welcome' has
    //the text 'Welcome'
    "#welcome" == "Welcome"

    //assert that the element with an id of 'firstName' has the value 'John'
    "#firstName" == "John"

    //change the value of element with
    //an id of 'firstName' to 'Something Else'
    "#firstName" << "Something Else"

    //verify another element's value, click a button,
    //verify the element is updated
    "#button_clicked" == "button not clicked"
    click "#button"
    "#button_clicked" == "button clicked"

//run all tests
run()

printfn "press [enter] to exit"
System.Console.ReadLine() |> ignore

quit()
RutujaNagare commented 2 years ago

Hi,

I tried as per given instruction. Downloaded Edge Drive and placed at correct location. But no luck this time as well.

Edge browser is opening but given URL is not entered.

Getting below error message on result EdgeBrowserIssue1

lefthandedgoat commented 2 years ago

Does this same set of code you are writing work with other browsers?

You will have to share more code than this. That error message is because the browser is null.