Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Interactions - KeyPress with Click - Unexpected error #2842

Closed
lukeis opened this issue Mar 3, 2016 · 10 comments
Closed

Interactions - KeyPress with Click - Unexpected error #2842

lukeis opened this issue Mar 3, 2016 · 10 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2842

What steps will reproduce the problem?

Actions a = new Actions(this.Driver);
IAction x = a.KeyDown(Keys.Shift)
      .MoveToElement(element)
      .Click()
      .MoveToElement(element2)
      .Click()
      .KeyUp(Keys.Shift)
      .Build();
x.Perform();

What is the expected output? What do you see instead?
Select 2 elements with shift key

I got exception (thrown on line: "x.Perform();" ):
OpenQA.Selenium.WebDriverException : Unexpected error. 

Selenium version: 2.12
OS: Windows7
Browser: Forefox
Brower version: 5.0
RemoteWebDriver




Reported by stryczekk on 2011-11-15 06:49:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-15 10:07:46

  • Labels added: Component-WebDriver, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Here is a test that passes for me (Win7 x64, FF 5.0):

        [TestMethod]
        public void TestMethod1()
        {
            IWebDriver browser = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"),
DesiredCapabilities.Firefox());
            browser.Url = "http://jqueryui.com/demos/selectable/";

            IList<IWebElement> elements = browser.FindElements(By.CssSelector("ol#selectable
li"));

            Actions a = new Actions(browser);
            IAction x = a.KeyDown(Keys.Shift)
                  .MoveToElement(elements[0])
                  .Click()
                  .MoveToElement(elements[1])
                  .Click()
                  .KeyUp(Keys.Shift)
                  .Build();
            x.Perform();

            browser.Quit();
        }

Server log is:

20:31:45.294 INFO - Executing: [new session: {platform=ANY, browserName=firefox, version=}]
at URL: /session)
20:31:52.099 INFO - Done: /session
20:31:52.102 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@7a4fe91e
at URL: /sessio
n/1321378290834)
20:31:52.102 INFO - Done: /session/1321378290834
20:31:52.140 INFO - Executing: [get: http://jqueryui.com/demos/selectable/] at URL:
/session/1321378290834/url)
20:31:57.627 INFO - Done: /session/1321378290834/url
20:31:57.631 INFO - Executing: [find elements: By.selector: ol#selectable li] at URL:
/session/1321378290834/elements)
20:31:57.657 INFO - Done: /session/1321378290834/elements
20:31:57.664 INFO - Executing: [send keys to active: ?] at URL: /session/1321378290834/keys)
20:31:57.674 INFO - Done: /session/1321378290834/keys
20:31:57.677 INFO - Executing: [mousemove: 0 false] at URL: /session/1321378290834/moveto)
20:31:57.865 INFO - Done: /session/1321378290834/moveto
20:31:57.868 INFO - Executing: [click: nothing] at URL: /session/1321378290834/click)
20:31:57.887 INFO - Done: /session/1321378290834/click
20:31:57.889 INFO - Executing: [mousemove: 1 false] at URL: /session/1321378290834/moveto)
20:31:58.020 INFO - Done: /session/1321378290834/moveto
20:31:58.022 INFO - Executing: [click: nothing] at URL: /session/1321378290834/click)
20:31:58.033 INFO - Done: /session/1321378290834/click
20:31:58.035 INFO - Executing: [send keys to active: ?] at URL: /session/1321378290834/keys)
20:31:58.041 INFO - Done: /session/1321378290834/keys
20:31:58.042 INFO - Executing: [delete session: 1321378290834] at URL: /session/1321378290834)
20:31:59.106 INFO - Done: /session/1321378290834

Reported by barancev on 2011-11-15 17:33:50

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

So, you probably have something special on your page that causes the issue.

Could you please provide a reduced test case that includes a sample page (HTML, CSS,
JS) and the test code to reproduce the issue?

Reported by barancev on 2011-11-15 18:05:50

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

When I use Your code, I also have Unexpected error.

09:34:34.959 INFO - Executing: [new session: {platform=ANY, browserName=firefox, version=}]
at URL: /session)
09:34:39.300 INFO - Executing: [null, newSession {"desiredCapabilities":"Capabilities
[{platform=ANY, browserName=firefox, version=}]"}]
09:34:39.872 INFO - Done: /session
09:34:39.910 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@fc8fb4b
at URL: /session/1325234053523)
09:34:39.911 INFO - Done: /session/1325234053523
09:34:39.981 INFO - Executing: [get: http://jqueryui.com/demos/selectable/] at URL:
/session/1325234053523/url)
09:34:39.982 INFO - Executing: [ff45ac3b-10e8-4192-8da4-abe5f75d3962, get {"url":"http://jqueryui.com/demos/selectable/"}]
09:34:43.684 INFO - Done: /session/1325234053523/url
09:34:43.689 INFO - Executing: [find elements: By.selector: ol#selectable li] at URL:
/session/1325234053523/elements)
09:34:43.690 INFO - Executing: [ff45ac3b-10e8-4192-8da4-abe5f75d3962, findElements
{"using":"css selector","value":"ol#selectable li"}]
09:34:43.720 INFO - Done: /session/1325234053523/elements

Reported by stryczekk on 2011-12-30 08:40:50

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Please can you try on a different machine and see if that is still an issue

Reported by david.burns@theautomatedtester.co.uk on 2012-06-08 08:53:05

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

ok, in new version of selenium I don't have error, but only one element is selected,
like the shift button does not work...

I try your code on page: http://jqueryui.com/demos/selectable/

Reported by stryczekk on 2012-06-14 10:58:09

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi!

Yes, it selects only one element - manually it does the same.
For selecting multiple elements use CTRL+click.

From my point of view, this issue is fixed.

Reported by a.u.savchuk on 2013-08-02 18:11:53

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

ok, in my opinion problem is sloved

Reported by stryczekk on 2013-08-07 07:26:09

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by a.u.savchuk on 2013-08-07 08:19:25

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:09

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant