ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Cannot use sendKeys() with Ctrl-Tab to switch tabs in browser #1040

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:

To test my web application, I need to switch between different browser tabs.  
This should be possible using WebDriver.sendKeys() with a key sequence created 
with Keys.chord() and sent to an enabled web element (e.g.: the <body> of the 
web page).

For example:

WebElement body = driver.findElement(By.tagName("body"));
String ctrl_tab = Keys.chord(Keys.CONTROL, Keys.TAB);
body.sendKeys(ctrl_tab);

This does nothing, though the chromedriver log shows the key sequences are 
being sent (see attached).

Using an Actions object does not work either; for example:

new Actions(driver).sendKeys(Keys.chord(Keys.CONTROL, 
Keys.TAB)).build().perform();

Software versions:
Chrome:  40.0.2214.111
ChromeDriver:  2.14.313457
Selenium:  2.44.0
Java:  1.7.0_67 (64-bit)
OS:  Windows 7

Possibly related issues: #581, #972, #987, #1003

Steps to reproduce:

Step through the attached Java class, pausing to opening tabs *manually* in 
Chrome once the browser is started but before keys are sent.

Note that manually typing Ctrl-Tab in the Chrome browser does cause the tabs to 
switch.

Also, this experiment did succeed with FirefoxDriver.

Original issue reported on code.google.com by cavillj...@gmail.com on 17 Feb 2015 at 9:30

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by cavillj...@gmail.com on 18 Feb 2015 at 2:53

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
We will be working on this issue. 

Original comment by andrewch...@chromium.org on 18 Feb 2015 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by gmanikp...@chromium.org on 24 Feb 2015 at 10:13

GoogleCodeExporter commented 9 years ago
This is a limitation in the way we simulate keyboard input in ChromeDriver. 
Keys get sent directly to the render process, bypassing the browser process. So 
any keyboard shortcut handlers in the browser process will not be invoked by 
sendKeys().

Original comment by samu...@chromium.org on 5 Mar 2015 at 10:44