-
I am trying to figure out how to make a script work to login to a website. It used to work, but after a change to their code, it stopped working. What happens is:
This resulted in 3 issues:
Here's the solutions i found:
If i go to the page manually, type in the username, hit the button, bring up the console, and run the following javascript, the login is successful:
Further, if CefSharp gets to the part with the password field, and shows the console (.ShowDevTools), the same script works. However, if i run it via ExecuteScriptAsyncWhenPageLoaded(), it does not work. Even a simple alert('a'); does not do anything. (Which is why i am not using MutationObserver or IntersectionObserver to wait for the password field.) I've also tried ExecuteDevToolsMethodAsync, to no avail. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I just answered my own question. ExecuteScriptAsyncWhenPageLoaded() does not work here, but, ExecuteScriptAsync() does. I guess this points to the page never fully being loaded, meaning, the script was not running at all. It ran in the console because there was no wait for it to load there. |
Beta Was this translation helpful? Give feedback.
I just answered my own question. ExecuteScriptAsyncWhenPageLoaded() does not work here, but, ExecuteScriptAsync() does. I guess this points to the page never fully being loaded, meaning, the script was not running at all. It ran in the console because there was no wait for it to load there.