It does not seem to work and keeps giving me an error regarding Bluetooth drivers Following is my code:-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
usernameStr = 'putYourUsernameHere'
passwordStr = 'putYourPasswordHere'
browser = webdriver.Chrome()
browser.get(('https://accounts.google.com/ServiceLogin?'
'service=mail&continue=https://mail.google'
'.com/mail/#identifier'))
# fill in username and hit the next button
username = browser.find_element_by_id('Email')
username.send_keys(usernameStr)
nextButton = browser.find_element_by_id('next')
nextButton.click()
# wait for transition then continue to fill items
password = WebDriverWait(browser, 10).until(
EC.presence_of_element_located((By.ID, "Passwd")))
password.send_keys(passwordStr)
signInButton = browser.find_element_by_id('signIn')
signInButton.click()
This is the error of my code:-
[11092:17164:0603/171812.746:ERROR:device_event_log_impl.cc(208)] [17:18:12.747] Bluetooth: bluetooth_adapter_winrt.cc:723 GetBluetoothAdapterStaticsActivationFactory failed: Class not registered (0x80040154)
Traceback (most recent call last): File "e:/python.py", line 62, in username = browser.find_element_by_id('Email') File "C:\Users\Bhaskar\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 360, in find_element_by_id return self.find_element(by=By.ID, value=id_) File "C:\Users\Bhaskar\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element 'value': value})['value'] File "C:\Users\Bhaskar\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Bhaskar\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="Email"]"} (Session info: chrome=83.0.4103.61)
Explain your problem in more detail including the error message or set of codes or screenshots.
The username box doesn't have the id 'Email', but 'identifierId'. The same goes for the 'next' button.
Try something like this (might work a bit different for you, since I have Google in a different language).
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
usernameStr = 'putYourUsernameHere'
passwordStr = 'putYourPasswordHere'
browser = webdriver.Chrome()
browser.get(('https://accounts.google.com/ServiceLogin?'
'service=mail&continue=https://mail.google'
'.com/mail/#identifier'))
# fill in username and hit the next button
username = browser.find_element_by_id('identifierId')
username.send_keys(usernameStr)
nextButton = browser.find_element_by_xpath('//*[@id="identifierNext"]/span/span')
nextButton.click()
After this, Google blocks my attempts...
User contributions licensed under CC BY-SA 3.0