Problems with send_keys method

92 views
Skip to first unread message

Nazmul Haque Sarker

unread,
Feb 19, 2014, 4:26:29 AM2/19/14
to seleniu...@googlegroups.com
for my mac os.

My selenium code is below:

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


driver
= webdriver.Chrome()
driver
.get("http://google.com")
body
= driver.find_element_by_tag_name("body")


body
.send_keys(Keys.COMMAND + "t")


Unfortunately it fails to open new tab
But in Firefox it works fine.
So far I found, chromedriver fails for special keys.
because it works fine for: driver.find_element_by_id("email").send_keys("nazmul@newscred.com")

Is there any mistake in my code or it's a driver issue?
Could you make me clear please?

Doug Dragon

unread,
Mar 7, 2014, 2:03:56 PM3/7/14
to seleniu...@googlegroups.com
You mentioned in the beginning that you downloaded ChromeDriver for MAC - If I'm not mistaken you want to press CMD and not CTRL. From selenium.webdriver.common.keys this should be "COMMAND= u'\ue03d'" if I'm reading that right.

Hope that helps,
-Doug


On Wednesday, February 19, 2014 4:26:29 AM UTC-5, Nazmul Haque Sarker wrote:
for my mac os.

My selenium code is below:

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


driver
= webdriver.Chrome()
driver
.get("http://google.com")
body
= driver.find_element_by_tag_name("body")


body
.send_keys(Keys.COMMAND + "t")


Unfortunately it fails to open new tab
But in Firefox it works fine.
So far I found, chromedriver fails for special keys.
because it works fine for: driver.find_element_by_id("email").send_keys("naz...@newscred.com")
Reply all
Reply to author
Forward
0 new messages