lefthandedgoat / canopy

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

Canopy Active Directory Pop-up Login #445

Closed pwyszynski closed 4 years ago

pwyszynski commented 6 years ago

Hello,

First of all, I'm not sure if that's the right place to be asking this, so if it isn't - let me know and I will move it to SO or some other indicated place :)

Straight to the topic, does Canopy implement any way to automatically login to NTLM protected websites? For now I use the IE browser, as it somehow magically automatically logs in current user, but I would love to test the website against more browsers, and unfortunately, they require me to log in through this pop-up window.

I've tried using the trick with appending the username and password to the URL in the following format `http://username:password@websiteurl.example", but it doesn't work for me.

I've also seen solutions with setting Firefox profile preference for ntlm-auth, but I'm not sure how can I use them with Canopy.

Could you perhaps give me some advice on how I can work with this?

Best regards :)

lefthandedgoat commented 6 years ago

To start firefox with options you can use this

https://gist.github.com/lefthandedgoat/ef20c7843e021a4f93c4

I haven't tried it but your code would probably look something like this:

let options = new Firefox.FirefoxOptions()
let profile = new FirefoxProfile("path/to/top/level/of/profile");
profile.SetPreference("extra", "pref"); //do your ntlm stuff here
options.Profile <- profile
start (FirefoxWithOptions options)
lefthandedgoat commented 6 years ago

Also, unsure if this still works, but this worked for canopy when I tried it years ago:

https://gist.github.com/lefthandedgoat/ef20c7843e021a4f93c4

Hope this helps!