Tried using -
view?.evaluateJavascript("document.getElementById('otpValue').type = 'number';",null)
But, only entries changed to number and keyboard didn't
There's an answer here that deals with hooking into the "show the keyboard" event and configuring it.
But you should probably try adding an inputMode attribute to the HTML itself, if you haven't done that already. I haven't tried it, but there's a lot of metadata in webpages now to help different things interpret and work with the page, so ideally if you add that info, it should Just Work. Some info about that here