Reputation: 63
I'm looking for a way to enter a one-time code into the https://login.microsoftonline.com/common/oauth2/deviceauth page in the Kod
field.
So far, I've only managed to stop the cursor from blinking, but the code is still not visible in the www page field. I've used JavaScript and I'm wondering if this is the right approach. I'm using the TEdgeBrowser
control and in DevTools in the Console tab there are no logs from the attempt to enter data. The field does not appear to be framed, so this problem is gone. I enter the script in the TEdgeBrowser::OnFrameNavigationCompleted
event.
String javascriptCode =
"setTimeout(function() { "
" console.log('Sprawdzanie pola input[name=otc]...');"
" var input = document.querySelector('input[name=otc]'); "
" if (input) { "
" console.log('Pole OTC znalezione! Wprowadzam kod...');"
" input.value = '12345'; "
" input.dispatchEvent(new Event('input', { bubbles: true })); "
" } else { "
" console.log('Błąd: Nie znaleziono pola OTC!');"
" } "
"}, 2000);";
EdgeBrowser1->ExecuteScript(javascriptCode);
Upvotes: 0
Views: 52