I can’t get selenium (on Python 3.11) to interact with the chrome’s (122.0.6261.112 (Official Build) (64-bit) (cohort: Stable)) profile selection pop-up (on the browser start-up) correctly.
So far I’ve tried:
- finding elements by visible text (nothing is found when searching for an XPATH containing “Sign in”)
- keyboard navigation (TAB switches between elements but ENTER doesn’t open the login pop-up despite playing the ‘click animation’)
- moving the cursor to the element I got the TAB to highlight and clicking (click() action de-selects the highlighted element)
- disabling the profile selection window by parsing options arguments when launching the browser (best I got was no default profile listed on the pop-up)
- logging-in manually for the duration of the test session (chrome opens new window which messes up the ‘yield’ statement of my browser fixture because “window is already closed, duh”; that login doesn’t persist between browser sessions so the pop-up appears again)
I’m bound to testing with the stable chrome because of the company policy. Our IT is controlling the versioning and might even force certain policies on the browser behavior. This profile selector started showing up yesterday and I really need to either disable it or get past it.
I’m a bit rusty on selenium, but iirc there should be some command line argument to select the profile on launch. You could try that, i remember there’s a way to specify command line arguments from selenium
If you mean the
--user-data-dir
and--profile-directory
options then here’s what happens:- I’m supposed to check the user-data-dir path to parse by opening
chrome://version
- the data dir path can be parsed either with the profile directory or not; in my case the profile is named
Default
- when parsing the full path chrome opens in incognito mode and selenium throws a
selenium.common.exceptions.SessionNotCreatedException
- cutting the
Default
off from the data dir path and disabling the profile directory option ends up in profile selection window not having the previously visibleProfile 1
- I’ve tried deleting
Profile 1
, it didn’t seem to do anything
edit: I misremembered the behavior when (not) parsing the full path to the default profile
- I’m supposed to check the user-data-dir path to parse by opening