File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// ==UserScript==
22// @name Automatically Select First Google Account to Sign In
33// @namespace typpi.online
4- // @version 1.4
4+ // @version 1.5
55// @description Selects the first Google account in the Google account selector page
66// @author Nick2bad4u
77// @match https://accounts.google.com/*
1919
2020 // Function to select the first account
2121 const selectFirstAccount = ( ) => {
22- const firstAccount = document . querySelector ( 'li.aZvCDf' ) ;
22+ const firstAccount = Array . from ( document . querySelectorAll ( 'li' ) ) . find ( el => el . textContent . includes ( '@gmail.com' ) ) ;
2323 if ( firstAccount ) {
2424 const firstLink = firstAccount . querySelector ( 'div[role="link"]' ) ;
2525 if ( firstLink ) {
2626 firstLink . click ( ) ;
2727 } else {
28- console . log ( 'First account link not found.' ) ;
28+ console . log ( 'First account link not found. This might be due to changes in the page structure or the account list not being fully loaded. ' ) ;
2929 }
3030 } else {
31- console . log ( 'First account not found on the page.' ) ;
31+ console . log ( 'First account not found on the page. Waiting for the element to load dynamically... ' ) ;
3232 }
3333 } ;
3434
You can’t perform that action at this time.
0 commit comments