Is there a way to tell WebDriver in C# Selenium tests to open Chrome developer tool console, or some other way to get console to open while running Selenium tests without breaking them?
Or ability to programmatically read output to the console?
So far I have tried opening console manually ( CTRL + SHIFT + I ) while test is running, but that did break the test every-time.
To open chrome console:
var inSim = new WindowsInput.InputSimulator()
inSim.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LCONTROL);
inSim.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LSHIFT);
inSim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.VK_J);
inSim.Keyboard.KeyUp(WindowsInput.Native.VirtualKeyCode.LSHIFT);
inSim.Keyboard.KeyUp(WindowsInput.Native.VirtualKeyCode.LCONTROL);
webDriver
(it will crash the test, but if you close the console, the same way you opened it, you will be able to continue) Notice - some OS have strict input rules and might prevent the inputSimulator from working when the computer is locked or when you are running this code in a machine which has no keyboard connected to it (a server that is handled remotely)
hope this helps...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.