ericmckean / chromedriver

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

chromedriver does not perform Keys.DOWN or Keys.ENTER for form/dropdown #919

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Issue Description:
Instead of using the approach to forms as explained in the selenium 'Next 
Steps' section (found here: https://code.google.com/p/selenium/wiki/NextSteps), 
I wanted chromedriver to key down (Keys.DOWN) and Keys.ENTER on an option in 
the form.  Chromedriver does not perform this, and it also doesn't fail.

Steps to reproduce 

driver.get("http://the-internet.herokuapp.com/dropdown");
WebElement dropdown = driver.findElement(By.cssSelector("select#dropdown"));

dropdown.click();
//implicit wait occurs; this does open the dropdown 
dropdown.sendKeys(Keys.DOWN);
//implicit wait occurs; does not key down in chromedriver
dropdown.sendKeys(Keys.DOWN);
//implicit wait occurs; does not key down in chromedriver
dropdown.sendKeys(Keys.ENTER);
//does not key enter in chromedriver
//the above performance doesn't occur; in FirefoxDriver, it works fine

Original issue reported on code.google.com by bryan.go...@gmail.com on 6 Oct 2014 at 3:16

GoogleCodeExporter commented 9 years ago
I've run across the same bug. I am using:

  Java selenium-chrome-driver 2.44.0
  native chromedriver 2.12

I am invoking:

  actions.contextClick(nextButton).sendKeys("t").perform();

Under Chrome, the context menu pops up but the keys are never sent. Under 
Firefox, the content menu pops up and the keys are sent.

Original comment by cow...@bbs.darktech.org on 28 Oct 2014 at 5:31

GoogleCodeExporter commented 9 years ago
The alternative I'm currently using (with chromedriver 2.12):

Select select = new Select(dropdown);
        select.selectByVisibleText("Option 1");
        dropdown.sendKeys(Keys.ENTER);

Original comment by bryan.go...@gmail.com on 29 Oct 2014 at 1:54

GoogleCodeExporter commented 9 years ago
Unfortunately, this will not work for me. Context menus are not HTML elements, 
so the only way to interact them is using the keyboard or mouse.

Thanks for the suggestion nonetheless.

Original comment by cow...@bbs.darktech.org on 29 Oct 2014 at 2:56

GoogleCodeExporter commented 9 years ago
I understand and prefer to have Selenium interact with elements as a user would 
in the real world, so I definitely would like to see a fix to this.

Original comment by bryan.go...@gmail.com on 29 Oct 2014 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 8 Dec 2014 at 8:05

GoogleCodeExporter commented 9 years ago
I tested it with chromedriver 2.12 + chrome 39
it will select option 2 -  same result as Firefox
let me  know you are still having problem.

Original comment by andrewch...@chromium.org on 8 Dec 2014 at 8:31

GoogleCodeExporter commented 9 years ago
Andrew,

This issue contains different code sniplets. Which ones did you test and work 
for you?

Thanks...

Original comment by cow...@bbs.darktech.org on 12 Dec 2014 at 6:15

GoogleCodeExporter commented 9 years ago
Finally, Option 2 is selected - same as Firefox.

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 7:09

GoogleCodeExporter commented 9 years ago
Andrew,

Does comment 1 work for you? Meaning:

  actions.contextClick(nextButton).sendKeys("t").perform();

Where "nextButton" is a link. This is supposed to open the link in a new tab. 
Notice that I reported this against version 2.12 and I believe I was also using 
Chrome 39.

Original comment by cow...@bbs.darktech.org on 12 Dec 2014 at 10:40

GoogleCodeExporter commented 9 years ago
please  provide me one piece of codes that I can run to show the problem.
how/where do I run
actions.contextClick(nextButton).sendKeys("t").perform();   ?

Original comment by andrewch...@chromium.org on 13 Dec 2014 at 12:10

GoogleCodeExporter commented 9 years ago
Andrew,

1. Go to http://www.google.com/
2. Set nextButton = "images" link in the top right corner
3. Run: actions.contextClick(nextButton).sendKeys("t").perform();
4. Notice that link does not open in new tab.

Original comment by cow...@bbs.darktech.org on 15 Dec 2014 at 5:03

GoogleCodeExporter commented 9 years ago
not sure what  you are trying  to do, 
your Selenium codes may not correct.
My guess is
you try to open Google Image page and key in "t"
Following will do the work

            Actions actions = new Actions(driver);
            WebElement we = driver.findElement(By.linkText("Images"));
            we.click();
            actions.sendKeys("t").perform();

Original comment by andrewch...@chromium.org on 15 Dec 2014 at 7:49

GoogleCodeExporter commented 9 years ago
Andrew,

I am trying to perform the following operation:

1. Go to google.com
2. Right click on the link "Images"
3. In the context menu, choose "open in new tab"

The code in your last comment performs a left-click on "Images" and then sends 
the key "t". This isn't what I'm trying to do.

Please try performing the steps I mentioned above.

Original comment by cow...@bbs.darktech.org on 15 Dec 2014 at 9:55

GoogleCodeExporter commented 9 years ago
To clarify, sending "t" into the context menu (step 3) is equivalent to 
choosing "open in a new tab". This is because "t" is an alias/mnemonic for that 
option.

Original comment by cow...@bbs.darktech.org on 15 Dec 2014 at 9:56

GoogleCodeExporter commented 9 years ago
How did the ticket I logged turn into this discussion?  Opening another ticket 
would seem to be in order.

Original comment by bryan.go...@gmail.com on 15 Dec 2014 at 9:57

GoogleCodeExporter commented 9 years ago
Bryan,

Apologies. I've moved this discussion to bug #1003.

Original comment by cow...@bbs.darktech.org on 15 Dec 2014 at 10:07

GoogleCodeExporter commented 9 years ago
good idea  to open another ticket.
Bryan,  any  comment on #8?

Original comment by andrewch...@chromium.org on 15 Dec 2014 at 11:19

GoogleCodeExporter commented 9 years ago
Thank you.  Re: #8:  I'm on Chrome 38 (still) and tested my code from #1 using 
both chromedriver 2.10 and 2.12.  Chromedriver does not select option 2 in the 
heroku dropdown in either version.  The alternative I offer in #2 works.  
However, I would still consider this a bug.  Please let me know if there is 
something I'm missing in the code snippet in #1.

Again, my thanks!

Original comment by bryan.go...@gmail.com on 15 Dec 2014 at 11:48

GoogleCodeExporter commented 9 years ago
To me both #1 and #2 get the same result.  #1 has option 2(two Down key)   #2 
has option 1.
use chrome 39.

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 12:33

GoogleCodeExporter commented 9 years ago
Updating to Chrome 39 didn't work.  Which version of Selenium are you using?  
I'm on 2.43.1

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 1:33

GoogleCodeExporter commented 9 years ago
I just upgraded to 2.44.0 and it still doesn't work with chromedriver.  It 
works just fine with firefoxdriver.  Perhaps I'm missing something basic.

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 1:50

GoogleCodeExporter commented 9 years ago
What version of chromedriver  you  use?
prefer chromedriver 2.12+
put aside   Selenium version for now.(2.43.1 is fine)

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 6:06

GoogleCodeExporter commented 9 years ago
I tried #1 in both chromedriver 2.10 and then 2.12, to no avail.  

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 6:44

GoogleCodeExporter commented 9 years ago
which OS you run the driver?

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 6:47

GoogleCodeExporter commented 9 years ago
Apologies for not including previously:  OS X, 10.9.5

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 6:48

GoogleCodeExporter commented 9 years ago
you are using Mac. this could make some difference. I need get a Mac to verify 
this.

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 6:56

GoogleCodeExporter commented 9 years ago
Running Win 7 + Chrome 32 via Browserstack, #1 runs as it should.  Looks like 
this might be a Mac issue...

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 7:13

GoogleCodeExporter commented 9 years ago
the base code is different.
you mainly  work on  Mac ?

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 7:19

GoogleCodeExporter commented 9 years ago
Indeed I do.  Perhaps I could make a contribution to the project to fix this.  
Also, tried Yosemite + Chrome 38 in Browserstack, it definitely looks like a 
Mac issue.

Original comment by bryan.go...@gmail.com on 16 Dec 2014 at 7:21

GoogleCodeExporter commented 9 years ago
good,  let  me know when you fix it.

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 7:28

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 12 Mar 2015 at 5:53

GoogleCodeExporter commented 9 years ago
Sorry I haven't had time to fix this.  If anyone else can get to it, feel free. 
 Sorry again.

Original comment by bryan.go...@gmail.com on 12 Mar 2015 at 5:55

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 2 Apr 2015 at 9:46