failure to authenticate
after starting the container, during authentication process, it seems that if the login process encounters the screen from the attached picture, it cannot continue and auth fails
ibeam version : 0.5.1
stack trace & logs:
2024-05-24 06:33:59,187|I| Cannot ping Gateway. Retrying for another 18 seconds
2024-05-24 06:34:01,230|I| Gateway connection established
2024-05-24 06:34:01,335|I| NO SESSION Status(running=True, session=False, connected=False, authenticated=False, competing=False, collision=False, session_id=None, server_name=None, server_version=None, expires=None)
2024-05-24 06:34:01,336|I| Authentication strategy: "B"
2024-05-24 06:34:01,336|I| No active sessions, logging in...
2024-05-24 06:34:01,337|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2024-05-24 06:34:10,887|I| Gateway auth webpage loaded
2024-05-24 06:34:10,887|I| Login attempt number 1
2024-05-24 06:34:16,441|I| Submitting the form
2024-05-24 06:34:20,170|I| Handling IB-Key promo display...
2024-05-24 06:34:21,278|E| Error encountered during authentication
Exception:
File "/srv/ibeam/ibeam_starter.py", line 167, in
<class 'selenium.common.exceptions.ElementClickInterceptedException'> Message: element click intercepted: Element is not clickable at point (392, 852)
picture from attachment
I may be wrong but to me it looks like the credentials you provided to iBeam are not yet registered with the IB key app. Have you used the same credentials in an interactive session and successfully got an auth request to your smart phone app and successfully login?
but they never were and that account setup is unchanged for more than 4 months now. the only thing required is the "continue" button to be clicked. i think that's the actual issue, according to the stacktrace (the element cannot be clicked) so my assumption is that the "continue" element was not properly selected (due to maybe a recent change in html structure from IB site)
after trying for a while to figure out what is going on, it seems like there is a delay that they added for the "continue" button to be clickable. is there a way to make the element being clicked after a while (a sleep) ?
i found the problem.. the fix is very hacky.. but the it is caused by a change in interactive broker's html content.
they changed the ibkey-promo-skip class element to have a "href=Dispatcher" which causes the
ib_promo_key_trigger.click()
to not work and trigger the
<class 'selenium.common.exceptions.ElementClickInterceptedException'> Message: element click intercepted: Element is not clickable at point (392, 852)
i fixed it by replacing
ib_promo_key_trigger.click()
with
continue_element = find_element(targets['IBKEY_PROMO'], driver)
driver.execute_script("arguments[0].click();", element)
could you please @Voyz integrate this change into the master branch (maybe a new version) in a nice/proper way ?
i attached the login_handler python script with my hacky update for reference. login_handler.zip
@fireinmyveins Thanks for doing some debugging on this and for reporting the issue 👍 Also thanks for sharing your solution.
Now here's the interesting thing:
It seems that the button is not clickable, yet in order for the step_handle_ib_key_promo method to be called, the IBKEY_PROMO must be clickable. It is defined in step_login:
trigger, target = wait_and_identify_trigger(
has_text(targets['SUCCESS']),
is_visible(targets['TWO_FA']),
is_visible(targets['TWO_FA_SELECT']),
is_visible(targets['TWO_FA_NOTIFICATION']),
is_visible(targets['ERROR']),
is_clickable(targets['IBKEY_PROMO']),
)
Not quite sure why would an element be marked as clickable, but then raise Element is not clickable at point when clicked on 🤷♂️ You mention the "href=Dispatcher" - how do you know that this causes the issue?
In either case, I just released voyz/ibeam:0.5.4-rc1 which contains your fix. I modified the script slightly, as we don't need to re-acquire the element once again I believe - it is passed down as ib_promo_key_trigger parameter:
def step_handle_ib_key_promo(self,
driver: webdriver.Chrome,
targets: Targets,
wait_and_identify_trigger: callable,
ib_promo_key_trigger: WebElement,
):
_LOGGER.info('Handling IB-Key promo display...')
# ib_promo_key_trigger.click()
time.sleep(3)
driver.execute_script("arguments[0].click();", ib_promo_key_trigger)
trigger, target = wait_and_identify_trigger(
has_text(targets['SUCCESS']),
is_visible(targets['ERROR'])
)
return trigger, target
Let me know if that works for you 👍
Also, @HaSiMiPa thanks for your comment. As far as I remember, this view appears only as an advert - you don't actually have to interact with it, only continue through it. Hence we simply click on 'Continue' and carry on normally.
@Voyz thanks for the update, but can't you push the code into a branch ? 0.5.4-rc1 doesn't seem to be anywhere (tag/branch)
to be honest, i have no idea why that error appears but i suspect it is one of the options mentioned in this post
i know the fix is not the best approach but it works and it is not so intrusive since this only happens once (when you login)
Hey @fireinmyveins it's on the master branch: https://github.com/Voyz/ibeam/commit/5f5331098d53643ac63a867f385ff28557dcc8fc
Thanks for linking to that SO post, interesting!
@Voyz I have stumbled upon the same issue as described in this issue, and I just wanted to let you know that 0.5.4-rc2 solved it for me too.
Thank you for the fix!
Glad to hear @elderanakain thanks for reporting back 👏👏
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 👍