selenium - How to generate key strokes from a batch file? -
I want to create a batch file to do the following:
- Start Selenium Server
- Run Protractor Test (Prometector Conf.JS)
- Block Selenium Server ()
Since it requires 2 different command prompt WebDrive Manager is starting and it is necessary to execute tests as well
I have achieved the following so far. A .bat file has been created with the following content:
start runTests.cmd webdriver-manager start Ctrl-C (** ** does not work)
< / Pre>However, I'm not able to understand a way to turn off Selenium server (which is achieved by pressing Ctrl + C on the same window on which the webdriver-manager start command is executed)
You can generate keystrokes using the VB script, which is batch file I can follow this post.
I followed this post: Replacing {F5} with {C} for Ctrl + C {c} So my file looks like this: < / P>
set obzhelle = create object ("WScript.Shell") objShell.SendKeys "^ {C}"
VBS "to save the extension.
I also came to know about how to set the focus on the second window (which you know the title of) to do this first, you can use your keystroke Can be directed to the appropriate window, so:
set obzhelle = create object ("WScript.Shell") objShell.AppActivate "Untitled - Notepad" objShell.SendKeys "^ {C}"
I used to experiment with a blank example of Notepad, so you can use the window title string (Ctrl + C does nothing in Notepad, but Alt + F4 closes it, so I used "% {F4}" to test it.)
< P> Then you can just call the VBS file with your phone to run the batch file.
Comments
Post a Comment