I am trying to write a script to help me track my Fitbit communities, but first I need to login to the site. Forgive me as I am a coding novice.
I am using Selenium in Python.
My code is as follows:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import re
##Loading selenium to handle java on leaderboard page
##
path_to_chromedriver = 'C:/python351/chromedriver/chromedriver.exe'
browser2 = webdriver.Chrome(executable_path = path_to_chromedriver)
##Login with selenium
##
login_url = 'https://www.fitbit.com/login'
browser2.get(login_url)
browser2.implicitly_wait(5)
email1 = browser2.find_element_by_name('email')
password1 = browser2.find_element_by_name('password')
email1.click()
email1.clear()
WebDriverWait(browser2, 10)
email1.send_keys('[email protected]')
WebDriverWait(browser2, 20)
password1.click()
password1.clear()
WebDriverWait(browser2, 20)
password1.send_keys('madeuppass')
WebDriverWait(browser2, 20)
form1 = browser2.find_element_by_class('common-btn common-btn-submit track-Auth-Login-ClickFitbit')
form1.submit()
When I run it I keep getting the following errors and the email/password boxes do not fill in. Here is the traceback:
C:\python351>python -i slogin.py
[WARNING:..\..\..\..\flash\platform\pepper\pep_module.cpp(63)] SANDBOXED
Vector smash protection is enabled.
Traceback (most recent call last):
File "slogin.py", line 28, in <module>
email1.click()
File "C:\python351\lib\site-packages\selenium\webdriver\remote\webelement.py",
line 74, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\python351\lib\site-packages\selenium\webdriver\remote\webelement.py",
line 457, in _execute
return self._parent.execute(command, params)
File "C:\python351\lib\site-packages\selenium\webdriver\remote\webdriver.py",
line 233, in execute
self.error_handler.check_response(response)
File "C:\python351\lib\site-packages\selenium\webdriver\remote\errorhandler.py
", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visi
ble
(Session info: chrome=50.0.2661.94)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7
c4),platform=Windows NT 6.1 SP1 x86_64)
I have been fiddling with this for hours and I can't get it to work. I see the element not visible error and it made me think I needed a delay, but then I tried to implement it (possibly poorly) and still I am getting errors. I also added the click and clear things as well as I saw those suggestions in other posts. I was able to login with RoboBrowser using the form submit, but some of the stuff I need to access later used java so it ended up being a dead end and now I've switched to Selenium and am stuck.