ibeam icon indicating copy to clipboard operation
ibeam copied to clipboard

Depreciated Selenium code

Open perrycyl opened this issue 1 year ago • 2 comments

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)

perrycyl avatar Jun 19 '24 18:06 perrycyl

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.

Voyz avatar Jun 22 '24 07:06 Voyz

Tested rc3 and the fix is successful.

perrycyl avatar Jun 29 '24 15:06 perrycyl

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 👍

Voyz avatar Jul 02 '24 06:07 Voyz