pythonselenium-webdriverselenium-chromedriverundetected-chromedriver

Selenium not loading elements on Plus500


I'm having a problem where when running selenium(4.12) & python(3.11.5) on chrome(116.xxx), elements don't load when selenium clicks on them. If I, while still having chromedriver and the script running, refresh and click on the elements myself, then they load and all operate perfectly fine.

Website in question is plus500

Not sure if this matters but this only started happening around the time I installed anaconda for a different side project. I have since uninstalled anaconda, selenium & python and done a fresh install ensuring to delete all files I could find pertaining to these but the problem still persists.

I've tried using undetected selenium, selenium stealth, a profile to load into plus500 automatically and attempt to retain any cookies, adding all/a mixture of all of the below options, creating a random useragent on every launch, trying on a separate computer all with fresh installs of everything, a different plus500 account, using actionsChains to attempt to mimic mouse movement by moving to the element and then having a random offset to randomly click somewhere on the element (and just clicking it without the offset). I've even attempted to use a proxy to no avail.

options = webdriver.ChromeOptions()
ua = UserAgent()
userAgent = ua.random
print(userAgent)
options.add_argument(f'--user-agent={userAgent}')
options.add_argument('--user-data-dir=chrome-data')
#options.add_argument('--disable-crash-reporter')
options.add_argument('disable-infobars')
#options.add_argument('--no-sandbox')
#options.add_argument('--disable-gpu')
options.add_argument('--start-maximized')
#options.add_argument('--disable-extensions')
#options.add_argument('--disable-dev-shm-usage')
options.add_argument(r'user-data-dir=C:\Users\perri\AppData\Local\Google\Chrome\User Data\Profile 3')
#options.add_argument(r'--profile-directory=C:\Users\perri\AppData\Local\Google\Chrome\User Data\Profile 3')
#options.add_argument('--disable-application-cache')
options.add_argument( '--disable-blink-features=AutomationControlled' )
#options.add_experimental_option('debuggerAddress', 'localhost:6666')
options.add_experimental_option('useAutomationExtension', False)
options.add_experimental_option('detach', True)
options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_experimental_option('excludeSwitches', ['disable-popup-blocking'])
options.page_load_strategy = 'eager'
s = Service(r'D:\Other\ShutDown\Code\Code\chromedriver-win64 - Trailing\chromedriver1.exe')
driver = webdriver.Chrome(service=s, options=options)
action = ActionChains(driver)

Only things I can think of that I haven't tried yet due to not being able to whether physically or mentally, is to switch to a different browser/driver (due to having to rewrite the entire xpaths/css locaters) or a different network.

Any/all help will be appreciate and I can give more information/specs where required as I'm not sure what to include.

Thanks


Solution

  • Based on the comments, your issue is caused by an open bug with selenium 4.12.0: https://github.com/SeleniumHQ/selenium/issues/12659 -

    "selenium seems to override _, breaking another package"

    You'll need to downgrade to selenium 4.11.2 (for Python) until the Selenium Team ships a new release with the fix.