Closing Chrome Gracefully

Wednesday, March 7, 2018
Avatar

Hello,

    I am trying to make a practice of including a step at the end of my RVL scripts that closes Google Chrome in a graceful manner. Previously,  a help desk person told me to include this row in my RVL script:

           Action     Global       DoSendKeys        {%F4%}

 

At one point this seemed to work, but now I get an error message whenever I run the script saying that {%F4%} is not valid input for that step. I've also tried replacing {%F4%} with {^+Q} (CTRL-Shfit-Q) to close it, but that produces the same error message. I stay away from using:

      Action    Global    DoKillByName    chrome.exe

     Action    Global    DoKillByName     rapisechrome.exe

Both of these steps work correctly, but when I use them and reopen chrome I get the little prompt in the corner of the window that says Chrome closed unexpectedly and wants to know if I want to restore the page. Personally, I don't like that little prompt because I imagine it might cause issues later on if I ever need to make a recorded manual step or do an image comparison that involves the same area of the screen that is covered by that little prompt. Does anyone know how I can close Google Chrome (better yet all browsers) at the end of my script in a way that won't cause that little restore prompt to appear.

4 Replies
Thursday, March 8, 2018
Avatar
re: Pinto18 Wednesday, March 7, 2018

Hi Nicholas,

The classic way is to kill the process (which you mention below), however it does have the side effect of making Chrome unhappy on startup. The alternatives are to tell Chrome to shutdown as if a user did it. The two ways are to either record a DoLClick(....) on the close button of the browser window (which will be treated as a Windows event rather than a browser event), or to use the DoSendKeys approach.

I think the issue is just that it should be:

{F4}

Regards

Adam

Thursday, March 8, 2018
Avatar
re: inflectra.david Thursday, March 8, 2018

Adam,

    Thanks for the response. I added a line in my RVL script that looks like:

                Action       Global       DoSendKeys      keys      string       {F4}

 

Unfortunately, this suggestion did not produce the result I was hoping for. Chrome does not seem to close in this case. Do you have a link or something that explains the Windows event? I have not used those yet in Rapise.

Thursday, January 10, 2019
Avatar
re: Pinto18 Thursday, March 8, 2018

Hello Pinto18,

 

I think your RVL script can try this:

ActionGlobalDoSendKeyskeysstring('^{F4}')

 

Thanks and regards,

Ray

 

Thursday, January 10, 2019
Avatar
re: rayhlc Thursday, January 10, 2019

Yeah, use '^{F4}' or '^w' to close only the active tab, and use '%{F4}' to close chrome (or any other) window.

If you use any other combination, don't use {} except for special keys like {TAB}, {ENTER}, {ESCAPE} or similar (see https://www.inflectra.com/Support/KnowledgeBase/KB85.aspx).

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Wednesday, March 7, 2018
  • Last Reply: Thursday, January 10, 2019
  • Replies: 4
  • Views: 7048