Depreciated Selenium code
Describe the bug
Docker fails to start for a new user trying to setup Google 2FA auth. Error for failed attempt by auth to use google_msg_handler.py code using driver methods find_elements_by_class_name, find_element_by_class_name, etc has been deprecated for a while now and should be using find_elements or find_element.
To Reproduce Steps to reproduce the behavior: Trying to get to the Google 2FA qrserver.com link as a user setting up a new iBeam instance.
Expected behavior Should return the qrserver.com link.
Environment IBeam version: 0.5.4-rc2 Docker image or standalone: Docker image Python version (standalone users only): OS: MacOs
Additional context The error messages should be here but I unfortunately cleared them before logging this bug.
Suggest a Fix google_msg_handler.py
sms_auth_el = driver_2fa.find_elements(By.CSS_SELECTOR, _GOOG_QR_CODE_CLASS)
if sms_auth_el:
driver_2fa.find_element(By.CLASS_NAME,_GOOG_AUTH_REMEMBER_CLASS).click()
data = urllib.parse.quote(sms_auth_el[0].get_attribute('data-' + _GOOG_QR_CODE_DATA))
_LOGGER.info(
'Web messages is not authenticated. Open this URL to pair web messages with your android phone:')
_LOGGER.info(
f'http://api.qrserver.com/v1/create-qr-code/?color=000000&bgcolor=FFFFFF&qzone=1&margin=0&size=400x400&ecc=L&data={data}')
WebDriverWait(driver_2fa, 120).until(sms_code_present)
sms_list_el = driver_2fa.find_elements(By.CSS_SELECTOR, _GOOG_MESSAGES_LIST_CLASS)
Well spotted @perrycyl thanks!
I've just pushed voyz/ibeam:0.5.4-rc3 fixing both of your issues with the Google Messages handler - let me know if it works.
Tested rc3 and the fix is successful.
I'm going to close this Issue as it is now fixed in voyz/ibeam:0.5.4. Let me know if you'd like to reopen it and continue the discussion. Thanks for contributing 👍