An Android screenshot that includes the keyboard: adb screencap, not DevTools
DevTools' Page.captureScreenshot draws the page alone, without the on-screen keyboard and without the address bar. What is really on the phone's screen comes from adb exec-out screencap -p.
adb exec-out screencap -p > screen.png
I had a chat window that slid under the keyboard on a phone. Screenshots from Page.captureScreenshot showed all of it, because DevTools renders the page and the keyboard is not part of the page. I saw the bug only in the adb screenshot, because it holds everything on the screen: the system bar, the address bar, the page and the keyboard.
The scale between the screenshot and the page is window.devicePixelRatio, 3 on a Pixel 9 Pro. The screenshot starts at the system bar and DevTools coordinates start at the top edge of the page, so vertically there is also an offset by the bars above the page.
You can connect the phone without a cable, over Wi-Fi adb.
checked: Pixel 9 Pro, Chrome on Android