I downloaded the code and entered the needed info (user id, pwd, utilityAccountId), but line 41 in the loginToComedAndAuthSAML() function throws a IndexError: list index out of range exception when its trying to split the response text on "SAMLResponse:"
Do you think you might be working on this, or can help trouble shoot?
in this request's response text (and for the 2nd request too: https://cec.opower.com/ei/x/e/energy-use-details) it seems to indicate that there was an internal server error (500) see the below, which I'm guessing isn't good
Also, for the first request
https://secure.comed.com/forms/login.fcc
the page redirects to
location.href = "/Pages/PageNotFoundError.aspx?requestUrl=" + encodeURI(location.pathname + location.search);
so it looks like a 404 response, not sure if it matters as you're just looking for the cookie.
<div>
<span>System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
at Exelon.Web.Forms.WebParts.SAML2SSO.GetAssertion(String accountNumber, String userName, String address, Boolean isResidential) in D:\a\1\s\Exelon.Web.Forms\WebParts\SAML2SSO.cs:line 184
at Exelon.Web.Forms.WebParts.SAML2SSO.CreateChildControls() in D:\a\1\s\Exelon.Web.Forms\WebParts\SAML2SSO.cs:line 78
</span>
</div>