Since the google translation api is shutting down, I am trying to get the google translate web element to work across the entire session for a user, so that they do not have to change the select box option to their language on each different page.
The initial load function is given as follows:
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, "google_translate_element");
};
Haven't done this before but by looking in the inspector in Google Chrome, I'm seeing that google loads a file called main.js. Look in that file and you will probably get a clue how they trigger the switch. main.js is of course packed and minified so try using this one JS Beautifier.
I will tho look at it more and get back to you :) Hope it helps!
UPDATE
The reason why you can't trigger the element like that seems to be because the select box is inside an iframe. You can't interact with an iframe of a different domain.