Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click after mouseOver not working #179

Closed
madoni opened this issue Jan 8, 2016 · 9 comments
Closed

click after mouseOver not working #179

madoni opened this issue Jan 8, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@madoni
Copy link

madoni commented Jan 8, 2016

Hi,
Firstly, let me say that I have been hunting for this application for a while!
Exactly what I have been looking for!

I am trying to incorporate it in an existing testing framework.
I ran into some issues with some rudimentary tests.

The use case requirement is to mouse over a nav item and click a link in the menu that is displayed which navigates to a new page. Below is the relevant selenese steps:

<tr>
    <td>waitForElementPresent</td>
    <td>id=nav-item-1</td>
    <td></td>
</tr>
<tr>
    <td>mouseOver</td>
    <td>id=nav-item-1</td>
    <td></td>
</tr>
<tr>
    <td>waitForVisible</td>
    <td>id=menu-item-1</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=menu-item-1</td>
    <td></td>
</tr>

In the messages logged I see the click on menu-item-1 succeeding, but the page does not navigate away causing all subsequent steps to fail.

Is there something I am overlooking? How can I get this to work?
Thanks!

@vmi vmi self-assigned this Jan 10, 2016
vmi added a commit that referenced this issue Jan 11, 2016
@vmi
Copy link
Owner

vmi commented Jan 11, 2016

Hi,

I cannot reproduce your problem.
Please provide more information.

I added the test case for this issue as "issue179" branch.
This test case passed normally.

https://github.com/vmi/selenese-runner-java/blob/issue179/src/test/resources/selenese/testcase_issue179.html

  1. start test web server.
sudo ruby tools/webserv.rb
  1. run test case for this issue.
java -jar target/selenese-runner.jar --config tools/run.config src/test/resources/selenese/testcase_issue179.html
[2016-01-11 14:33:31.789 +09:00] [INFO] Start: Selenese Runner 2.2.0
[2016-01-11 14:33:35.170 +09:00] [INFO] Initial window size: system default
[2016-01-11 14:33:35.170 +09:00] [INFO] Initialized: FirefoxDriver
[2016-01-11 14:33:35.210 +09:00] [INFO] Screenshot directory: tmp/img
[2016-01-11 14:33:35.210 +09:00] [INFO] Screenshot on fail directory: tmp/img/failed
[2016-01-11 14:33:35.210 +09:00] [INFO] JUnit result directory: tmp/xml
[2016-01-11 14:33:35.210 +09:00] [INFO] HTML result directory: tmp/html
[2016-01-11 14:33:35.212 +09:00] [INFO] Timeout: 30000 ms
[2016-01-11 14:33:35.579 +09:00] [INFO] Start: TestSuite[Issue #179] (src/test/resources/selenese/testcase_issue179.html)
[2016-01-11 14:33:35.592 +09:00] [INFO] Existing driver found.
[2016-01-11 14:33:35.599 +09:00] [INFO] Current speed: 0 ms/command
[2016-01-11 14:33:35.600 +09:00] [INFO] Start: TestCase[Issue #179] (src/test/resources/selenese/testcase_issue179.html)
[2016-01-11 14:33:35.601 +09:00] [INFO] baseURL: http://localhost
[2016-01-11 14:33:35.624 +09:00] [INFO] <1> Command#1: open("/issue179.html")
[2016-01-11 14:33:35.797 +09:00] [INFO] - [Success] URL: [http://localhost/issue179.html] / Title: [Issue #179]
[2016-01-11 14:33:35.797 +09:00] [INFO] <2> Command#2: type("name=id", "scott")
[2016-01-11 14:33:35.968 +09:00] [INFO] - [Success]
[2016-01-11 14:33:35.968 +09:00] [INFO] <3> Command#3: type("name=password", "tiger")
[2016-01-11 14:33:36.085 +09:00] [INFO] - [Success]
[2016-01-11 14:33:36.085 +09:00] [INFO] <4> Command#4: clickAndWait("id=login")
[2016-01-11 14:33:36.793 +09:00] [INFO] - [Success] URL: [http://localhost/issue179_02.html] / Title: [Issue #179 Logged in]
[2016-01-11 14:33:36.793 +09:00] [INFO] <5> Command#5: waitForElementPresent("id=nav-item-1")
[2016-01-11 14:33:36.833 +09:00] [INFO] - [Success]
[2016-01-11 14:33:36.833 +09:00] [INFO] <6> Command#6: mouseOver("id=nav-item-1")
[2016-01-11 14:33:36.928 +09:00] [INFO] - [Success]
[2016-01-11 14:33:36.928 +09:00] [INFO] <7> Command#7: waitForVisible("id=menu-item-1")
[2016-01-11 14:33:36.984 +09:00] [INFO] - [Success]
[2016-01-11 14:33:36.984 +09:00] [INFO] <8> Command#8: click("id=menu-item-1")
[2016-01-11 14:33:37.111 +09:00] [INFO] - [Success] URL: [http://localhost/issue179_03.html#1] / Title: [Issue #179 Item selected]
[2016-01-11 14:33:37.111 +09:00] [INFO] <9> Command#9: waitForElementPresent("name=q")
[2016-01-11 14:33:37.146 +09:00] [INFO] - [Success]
[2016-01-11 14:33:37.147 +09:00] [INFO] <10> Command#10: type("name=q", "selenium")
[2016-01-11 14:33:37.249 +09:00] [INFO] - [Success]
[2016-01-11 14:33:37.249 +09:00] [INFO] <11> Command#11: clickAndWait("css=input[type=\"submit\"]")
[2016-01-11 14:33:37.882 +09:00] [INFO] - [Success] URL: [http://localhost/issue179_04.html] / Title: [Issue #179 Search result]
[2016-01-11 14:33:37.882 +09:00] [INFO] <12> Command#12: assertText("id=query", "selenium")
[2016-01-11 14:33:37.942 +09:00] [INFO] - [Success]
[2016-01-11 14:33:37.945 +09:00] [INFO] End(2.343sec): TestCase[Issue #179] (src/test/resources/selenese/testcase_issue179.html)
[2016-01-11 14:33:37.945 +09:00] [INFO] End(0.000sec): TestSuite[Issue #179] (src/test/resources/selenese/testcase_issue179.html)
[2016-01-11 14:33:38.040 +09:00] [INFO] Generated JUnit result: tmp/xml/TEST-testcase_issue179.xml
[2016-01-11 14:33:38.188 +09:00] [INFO] Generated HTML result: tmp/html/TEST-testcase_issue179.html
[2016-01-11 14:33:38.188 +09:00] [INFO] Generated failsafe summary: tmp/xml/failsafe-summary.xml
[2016-01-11 14:33:38.192 +09:00] [INFO] Generated index of HTML results: tmp/html/index.html
[2016-01-11 14:33:38.192 +09:00] [INFO] Exit code: 0
[2016-01-11 14:33:38.329 +09:00] [INFO] Quit: FirefoxDriver

@madoni
Copy link
Author

madoni commented Jan 11, 2016

Thanks @vmi for taking a look at this.
I took a closer look at the markup and js on the site I have been testing and I noticed that the mouseenter/mouseleave events are being used to reveal/hide the nav menu. Could this be a reason why I am seeing this issue?

I ran the html test in Selenium IDE and it works... but not with selenium-runner.

Before discovering this library, I was working on my own implementation to run selenese tests.
I used the code below to "interpret" the mouseOver selenese command.

private void mouseOver(WebElement element) {
    Actions action = new Actions(driver);
    action.moveToElement(element).build().perform();
}

And this seems to work in this context.

@vmi
Copy link
Owner

vmi commented Jan 12, 2016

Hmmm, my test case failed on SeleniumIDE when change 'mouseover' to 'mouseenter' in addEventListener parameter at issue179_02.html.
Because SeleniumIDE does not fire "mouseenter" event by mouseOver command.

Please provide the test case and html in which SeleniumIDE succeeds and in which Selenese Runner fails.

@madoni
Copy link
Author

madoni commented Jan 15, 2016

I just created a PR #180 with the test and updated markup.
Please take a look!

vmi added a commit that referenced this issue Jan 16, 2016
@vmi vmi added the bug label Jan 17, 2016
@vmi vmi added this to the 2.3.0 milestone Jan 17, 2016
vmi added a commit that referenced this issue Jan 26, 2016
@vmi
Copy link
Owner

vmi commented Jan 26, 2016

Hi,
I fixed this problem on issue179 branch.
Please test it.

Note: I recommend to use waitForVisible instead of waitForElementPresent to wait for menu item.
Because WebDriver can't click the element which exists but isn't visible.

@madoni
Copy link
Author

madoni commented Jan 26, 2016

Thank you... I will give it a shot and get back to you!

On Tue, Jan 26, 2016 at 5:23 PM Motonori IWAMURO [email protected]
wrote:

Hi,
I fixed this problem on issue179 branch.
Please test it.

Note: I recommend to use waitForVisible instead of waitForElementPresent
to wait for menu item.
Because WebDriver can't click the element which exists but isn't visible.


Reply to this email directly or view it on GitHub
#179 (comment)
.

@madoni
Copy link
Author

madoni commented Jan 28, 2016

Looks like this fixed it! I was able to successfully run the test on the command line.
However, I was trying to use this library programmatically.
And for some reason, it fails on the same test.

Would this be the correct way to use it?
I need to set up a custom proxy on the driver before passing it to the runner.

Runner runner = new Runner();
runner.setDriver(driver);
runner.run("src/test/resources/selenese-runner.html");

@vmi
Copy link
Owner

vmi commented Jan 28, 2016

Hmmm, it works on my environment.

  1. I added following class to issue179 branch.
    https://github.com/vmi/selenese-runner-java/blob/issue179/src/test/java/EmbedTest.java
  2. I built it: mvn -P package
  3. I started test webserver on the top level of cloned directory: sudo ruby ./tools/webserv.rb
  4. I run test code: ./tools/run-embed-test.sh
#!/bin/bash

set -eux

java -cp target/test-classes:target/selenese-runner.jar EmbedTest src/test/resources/selenese/testcase_issue179.html
  1. It works!

@madoni
Copy link
Author

madoni commented Jan 29, 2016

@vmi, I was setting the driver timeouts explicitly and looks like that was causing the issue.
Once I removed the line, the tests worked fine!
Thank you once again for all your support!
I will be continuing to test other scenarios... will reach out to you if anything comes up!
Cheers!

@vmi vmi closed this as completed Jan 30, 2016
vmi added a commit that referenced this issue Nov 3, 2020
vmi added a commit that referenced this issue Apr 13, 2021
vmi added a commit that referenced this issue Sep 23, 2021
vmi added a commit that referenced this issue Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants