-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Chrome not be restarted on starting, can tab be auto-closed after automation? #164
Comments
The rationale for this issue is to check 1. if it is possible now to run TagUI while keeping users' existing tabs open (maybe reading documentation or some other reference materials) and 2. to keep Chrome behavior consistent across different OSes, for eg not having many tabs with batch automation. |
Lines to evaluate whether restarting Chrome is necessary - |
Verified that with current Chrome release (v66.0), the behavior remains. If an existing session of Chrome is not killed before initiating Chrome process with websocket opened, there won't be a connection for interacting with and controlling Chrome (see below, nothing returned)
If existing session is killed before launching Chrome, |
Found a workaround to force Chrome open as a new process - by explicitly specifying a user directory using
Or alternatively, just exit the tab leaving the new Chrome process idling. But security standards prevent browser tab from being able to be closed by script. Which means have to kill just that new process. Probably using ps and grep command to get the ID to kill. For Windows need to check for what can be used, so behavior is consistent across OSes. For macOS / Linux, following command returns process ID Chrome session launched by TagUI - For macOS / Linux, following in
|
Above commit adds in working version of this new feature, with following implementation - final version for macOS / Linux, to handle leading space if process id is short
final version for Window using wmic command to retrieve process id
Above blocks of code to kill the Chrome processes launched by TagUI will be executed before running automation and then after running automation as per the original workflow. If speed mode is use, the process will not be killed. In addition, for batch automation, the behavior would be restarting with the single new tab. |
This feature is now usable from cutting edge version which can be downloaded here to overwrite existing local packaged installation. (backup beforehand). How it works is by creating a separate Chrome user profile for TagUI's use, so that profile is launched whenever TagUI automation is run. This way, existing Chrome browser tabs used by the user will not be closed and affect their work. Credentials (signed-in passwords and so on), will have to be re-entered as the browser will start off on a clean slate during the first run. Eg can use wait 30 seconds or live step to pause the automation to login. @adegard might find this useful. |
The interesting thing is that on my linux machine (Fedora 28) even with the last release my running chrome hasn't been closed. |
Oh my colleague has this observation as well, his Linux Chrome doesn't get killed on running TagUI automation. Looks like it is only impacting Windows and macOS. I wonder why. In the last version, there is a pkill google-chrome command at start and end of execution, not sure why that process it not killed. Perhaps the existing chrome proesss is not called google-chrome command, or that process is launched under a different user from the shell invoking TagUI? |
I've informed power users about this new feature.. See if there are bugs or improvements to be made from the commit. Frankly, the way to get process id using ps / wmic and doing string manipulation using cut, sort, head etc is not ideal but what I found to be compatible with existing architecture of invoking from shell / batch script, that works regardless whether users have a development environment or not. |
This is not the case. Having a look at the command above
|
I see, you are saying that the process is called as the same user but not picked up by the ps command on Linux. @lohvht we can have a look at your Linux's environment this week to see why the last version of TagUI doesn't kill existing user browser tabs (that behavior will be be ok not to be changed), but at least the cutting version should kill the session invoked as tagui_user_profile. |
TagUI kills existing Chrome process before starting automation, in order to establish a websocket connection that can only be invoked when a fresh process is started. This makes it inconvenient for users who are having open tabs in Chrome, especially during research and development.
Creating this issue to revisit -
The text was updated successfully, but these errors were encountered: