Auto start and join google video hangout in chrome browser from ubuntu terminal - google-chrome

I have been looking all over for this and I feel like this should be very straight forward.
I am setting up a conference room computer and I want to automate starting AND joining a google video hangout in google chrome from a script that I run in the terminal. Very specific to start and join from terminal because I would like to do other scripting around starting, stopping, timing, etc.
google-chrome --start-fullscreen --app=https://hangouts.google.com/hangouts/_/company_name/room_name
This will open a new google-chrome web browser and get me all the way to the goal line, however I need to hit the 'Join' button to get into it. I was wondering how I can do something similar to what I have but automatically 'Join' the hangout?

I have also faced same issue while automating google hangouts.. You can below work around for ubuntu.
You can use xdotool utility to send keyboard/ mouse events. As you launch hangout conference call using CLI, focus already on join button. Just use below command just after launching hangouts.
xdotool key KP_Enter
Example:
google-chrome --start-fullscreen --app=https://hangouts.google.com/hangouts/_/company_name/room_name;
sleep 10;
xdotool key KP_Enter;

I was trying for the same thing but on OSX. I found that if you press the return key twice, it will join. I was unable to execute javascript to click on the button so I resorted to that.
I would think the answer be a script that does that first portion you mentioned adding on 2 return key presses on the active window which should be Google Chrome.

Related

Is there a way to run Google Lighthouse tests headlessly?

So I'm trying to programmatically conduct Google Lighthouse audits on several webpages, and I'm running into an issue. After installing Chrome and node/npm/lighthouse on an Amazon Linux 2 EC2 instance, I am able to successfully run LightHouse tests when I initiate a GUI session and run a command from a terminal within the GUI (this launches chrome and conducts the test as usual) but I am unable to do the same thing from the command line. This is the error I get when launching lighthouse.
ChromeLauncher:error [42565:42565:0516/170626.787500:ERROR:brower_main_loop.cc (1386) Unable to open X display.
While there are a couple of other errors, I believe this is the one I should be paying attention to, because when I try to just launch Google Chrome, that is the exact error I get, so I am inclined to believe it is an issue with trying to launch on a display.
I've also tried the "--headless" option when launching chrome and get
[0516/171128.450564:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir. [0516/171128.521499:ERROR:vaapi_wrapper.cc(594)] Could not get a valid VA display [0516/171128.524992:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is egl
Another user with a similar question decided to use the Google Pagespeeds API, which will not a be a solution for me-- it needs to be done locally.
Because this works fine on a GUI session with the same server, I really think it's just a display rendering issue, but I don't know how to solve this. Maybe "simulating" a display? I've also tried entering export DISPLAY=1:0, which apparently worked for some users and caused me to stop seeing the error, but the functionality was still broken when running the audit.
Any help would be so useful!!
Information found in this stackoverflow question was infinitely helpful. Although I still get a slew of errors when I try to launch the browser, I can successfully run LightHouse and audit the pages I want to without any errors.

Force "Add to homescreen" prompt a second time on chrome

I am trying to build a PWA. I managed to trigger the prompt a first time and installed the app on my shell (desktop). I then deleted it and I would like to force the prompt to reappear (for debug purpose) but it won't.
I set my chome flag Bypass user engagement checks to enabled, but there's still nothing I can do to trigger the prompt.
When I click on the console setting Application>Manifest>Add to homescreen, nothing happens and I don't receive any error message either.
It's exactly the same code that worked the first time. I just want to trigger it again now that the desktop shortcut has been deleted.
Also struggled with this issue.
At last found that going to chrome://apps/ and removing the app will enable to re-add it
If the chrome://flags/#bypass-app-banner-engagement-checks flag is enabled and you are still not getting the banner, its high likely one of PWA criteria is not met anymore.
It might have worked before. But with the changing code, something might have went wrong with Service worker, accessing via HTTP instead of HTTPS or having an invalid certificate kind if issues might have made your app not eligible for App install banner.
Validate: Validate your current sites PWA eligibility using Chrome Developer tools -> Audits -> Perform Audit -> Progressive Web App. See if all goes through regarding PWA criteria and if you see all looks good and still you don't get the Install Banner, post the Audit screenshot to give us some idea on whats going on.
You can just also just set it in the Developer Tools under Application by checking on Update on reload or click on Unregister to completely remove the SW. Dirty, but does the trick all the time.

how to run batch file in chrome

I tried using very simple HTML to create several links to several batch files on my server that are intended to run when users click on the links. Using Chrome, every time I click on one of those files my browser displays the script itself (even though its a .bat) and doesn't actually run the script. Internet Explorer runs it every time, however all the users on the network use Chrome for web browsing.
Is there any way to force Chrome (preferably through HTML or VB or some other scripting on the page itself rather than change all of the users' browser settings) to run these batch files when the user clicks on the link?
The answers given so far - that it's "not possible" - are incorrect or outdated. Using Chrome Apps you can call executables (called "hosts") if they are registered with Chrome. Of course a Chrome App is a client application so you need to distribute it.
See https://developer.chrome.com/extensions/nativeMessaging#examples
HTML, JS on browser cannot run shell command, command line. You have to implement server script to execute your bat file then call it from HTML, JS via Ajax or direct link.

Windows .net Google.Apis hangs on the call to InsertMediaUpload.Upload -- there is no timeout

I am using GoogleApis to upload documents to Google Drive using the InsertMediaUpload class from the FilesResource namespace and the Upload method. It is working well for me with the following exception:
After calling InsertMediaUpload, a browser window appears asking the user to log into their Google (usually Gmail) account. If the user simply closes the browser window instead of clicking on "Accept" or "Cancel" then the current process appears to be hung. I suppose there should a timeout of a minute or two so that if the user opts to not log in the current windows application will not simply hang and stop working indefinitely.
There is no need for sample code here. What should happen when the user simply closes the browser window instead of clicking cancel if they are no longer interested in uploading a document? Crashing (or hanging) the current process should not be a possibility, but that is what occurs. One would hope closing the browser window would have the same effect as clicking the cancel button -- just another way of opting out of an upload to Google Drive, right?
Thanks in advance for any help with this.
You're not supposed to get authentication message from InsertMediaUpload class. You should handle authentication by yourself. Authentication browser window you get is for your development convenience, not for production code. Please take a look at .net quickstart. In this quickstart, you'll see GetAuthorization method which handles authentication. Modify this method on your needs and you'll get what you want.

Chrome apps that run on startup?

What would be the easiest way for me to set up a Chrome extension that starts when I log in to my Windows account, and can be connected to a WebSocket server to check for, say, new messages, and then pop open a desktop notification, that clicks to the messages web page?
I expect that making an extension is straight forward, as well as getting it to communicate with WebSockets, and making the desktop notification.
But what about making it automatically start when I log in to the computer? What would be a good way to do this in Windows? I am not interested in having the chrome browser to open up at log in, but I certainly don't mind if I see Chrome in the task bar.
You might look into chrome.runtime.onStartUp: https://developer.chrome.com/apps/runtime#event-onStartup, which is
"Fired when a profile that has this extension installed first starts up."
Also, you can use chrome.alarms to schedule a function to run every minute or so, to open a WebSocket somewhere, etc.
The app may try to unload itself if there are no active windows, so you can call some action in chrome.runtime.onSuspend (like loading an XHR somewhere) to cause onSuspendCanceled to trigger.