2

I am trying to create a small test program that is able to login into gmail. So far the program opens up the website on chrome but then fails to actually type anything into the "Enter Email" form box. Also I am receiving an error within the shell which may provide insight into my question.

Driver Version: 2.40 Chrome Version: 67.0.3396.99

Below is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver= webdriver.Chrome('C:\chromedriver_win32\chromedriver.exe')
driver.get("http://mail.google.com")
emailid=driver.find_element_by_name("identifier")
emailid.send_keys("samplekeys")

Below is the error:

Traceback (most recent call last):
  File "C:\gmail.py", line 7, in <module>
    driver.get("http://mail.google.com")
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 332, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: missing or invalid 'entry.level'
  (Session info: chrome=67.0.3396.99)
  (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.17134 x86_64)

Any help would be greatly appreciated!

0

2 Answers 2

1

try this :

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Chrome(executable_path = r'C:/chromedriver_win32/chromedriver.exe')
browser.get("http://mail.google.com")  

wait = WebDriverWait(browser, 10)

user_name = wait.until(EC.element_to_be_clickable((By.ID, 'identifierId')))
user_name.click()
user_name.send_keys("samplekeys")
Sign up to request clarification or add additional context in comments.

3 Comments

i don't think that he need to click on element, but try it.
which error ? because it is running in my system , I am using windows 10 though
@DrutaRuslan : Yep , no need to click , but I do not see any harm if he clicks it.
0

You need to download the chromedriver, and put the path to your webdriver.Chrome(), for example my chromedriver are in /usr/local/bin/chromdriver

driver = webdriver.Chrome('/usr/local/bin/chromedriver')

or for widndows

driver = webdriver.Chrome(executable_path = r'C:\chromedriver_win32\chromedriver.exe')

10 Comments

Ok but I am confused as to how the web page was launched though. If i didn't add the driver location wouldn't the page not even launch?
i don't know, but for example i can open the chrome without chromedriver
can you show your code how do you pass the chromedriver?
Do you think it may have to do with the new chrome not being compatible with he driver?
can you try to use 'C:\\chromedriver_win32\\chromedriver.exe' ? with double slash
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.