CasCard/AutoCDSL

Unable to locate 'pin' element to enter Kite pin

Closed this issue · 4 comments

Hi,

Thanks for the utility. I thought of automating and found this luckily which saved a lot of my time.
auto-cdsl-selector-issue.txt

I've deployed as you mentioned but I'm encountering the below issue

{
"errorMessage": "Message: no such element: Unable to locate element: {"method":"id","selector":"pin"}\n (Session info: headless chrome=69.0.3497.81)\n (Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.14.255-273-220.498.amzn2.x86_64 x86_64)\n",
"errorType": "NoSuchElementException",
"stackTrace": [
" File "/var/task/lambda_function.py", line 102, in lambda_handler\n driver.find_element_by_id('pin').send_keys(KITE_PIN)\n",
" File "/opt/python/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id\n return self.find_element(by=By.ID, value=id_)\n",
" File "/opt/python/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element\n 'value': value})['value']\n",
" File "/opt/python/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute\n self.error_handler.check_response(response)\n",
" File "/opt/python/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response\n raise exception_class(message, screen, stacktrace)\n"
]
}

I dumped the page just before finding the 'pin' element and found out that it's still the first page where we enter username and password so not able to find the element.

I tried the same code in normal Chrome and it's working as expected so I'm wondering if it's an issue with headless chrome? And also not sure if it's happening only to me.

Please let me know if you have any suggestions.

Thanks for reaching out . It's working at my end without any issue and since the AWS deployment is independent of the platform, It should be working .
I hope you have set up PIN-based login as well in Zerodha after entering your username and password.
Two factor authentication is not support with this script . Let me know if the issue is still persisting

Thanks for the reply. PIN-based is also a 2-factor authentication, isn't it? I believe you're talking about TOTP authentication using any authenticator like Google authenticator. In my case I did use TOTP-based but I've changed it back to static PIN-based authentication yesterday and the script is working fine in normal Chrome so something might be happening in headless mode. I'll investigate more and let you know.

TOTP like Google authenticator changes every second . There isn't any api that we can have access to those pins hence static pin only works

I don't think it changes every second, if it is how will users enter the code. TOTP will get refreshed every 30 seconds I think. Anyhow, I'm not using TOTP here, it's just a static pin. I couldn't try yesterday due to other commitments so will try today and post the update here. Thanks.