• <legend id='7e5Sk'><style id='7e5Sk'><dir id='7e5Sk'><q id='7e5Sk'></q></dir></style></legend>
  • <tfoot id='7e5Sk'></tfoot>

  • <i id='7e5Sk'><tr id='7e5Sk'><dt id='7e5Sk'><q id='7e5Sk'><span id='7e5Sk'><b id='7e5Sk'><form id='7e5Sk'><ins id='7e5Sk'></ins><ul id='7e5Sk'></ul><sub id='7e5Sk'></sub></form><legend id='7e5Sk'></legend><bdo id='7e5Sk'><pre id='7e5Sk'><center id='7e5Sk'></center></pre></bdo></b><th id='7e5Sk'></th></span></q></dt></tr></i><div id='7e5Sk'><tfoot id='7e5Sk'></tfoot><dl id='7e5Sk'><fieldset id='7e5Sk'></fieldset></dl></div>

        <bdo id='7e5Sk'></bdo><ul id='7e5Sk'></ul>

        <small id='7e5Sk'></small><noframes id='7e5Sk'>

      1. Selenium 和 :hover css

        时间:2023-11-01
          <legend id='WBfrU'><style id='WBfrU'><dir id='WBfrU'><q id='WBfrU'></q></dir></style></legend>
          <tfoot id='WBfrU'></tfoot>
            <bdo id='WBfrU'></bdo><ul id='WBfrU'></ul>
                <tbody id='WBfrU'></tbody>

                  <small id='WBfrU'></small><noframes id='WBfrU'>

                  <i id='WBfrU'><tr id='WBfrU'><dt id='WBfrU'><q id='WBfrU'><span id='WBfrU'><b id='WBfrU'><form id='WBfrU'><ins id='WBfrU'></ins><ul id='WBfrU'></ul><sub id='WBfrU'></sub></form><legend id='WBfrU'></legend><bdo id='WBfrU'><pre id='WBfrU'><center id='WBfrU'></center></pre></bdo></b><th id='WBfrU'></th></span></q></dt></tr></i><div id='WBfrU'><tfoot id='WBfrU'></tfoot><dl id='WBfrU'><fieldset id='WBfrU'></fieldset></dl></div>
                  本文介绍了Selenium 和 :hover css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 selenium-rc 和 java 客户端,我想测试一个菜单,当用户将鼠标移到它上面时会打开该菜单.当鼠标离开菜单时它会关闭.这是使用 :hover css 完成的,没有任何 javascript.

                  Using selenium-rc and the java client, I want to test a menu which opens when the user moves the mouse over it. It closes when the mouse leaves the menu. This is done using :hover css, without any javascript.

                  在 selenium 中,有很多鼠标操作的方法,但似乎没有一个会触发任何要使用的 css :hover 样式.

                  In selenium, there are many methods for mouse actions, but none of them seems to trigger any css :hover style to be used.

                  Google 显示我并不孤单,但还没有解决方案.有些人评论说您必须添加一些 javascript 代码;但是,在 selenium rc 中,我认为我什至没有合适的位置来存放用户贡献的附加 javascript 代码.

                  Google shows that I am not alone with this problem, but there has not be a solution. Some folks comment that you had to add some javascript code; however, in selenium rc, I don't think that I even have a proper place for user-contributed additional javascript code.

                  我希望下面的代码能够工作,因为 div#navi_settings 包含的菜单包含 - 通常不可见 - 一个元素:

                  My wish would be the following code to work, given that a div#navi_settings contained the menu which contains the - normally invisible - a element:

                  selenium.mouseHover("css=div#navi_settings");
                  assertTrue(selenium.isVisible("//a[contains(text(), 'Text on link')]"));
                  

                  很遗憾,moveHover() 方法尚不存在.

                  Unfortunately, the method moveHover() does not yet exist.

                  推荐答案

                  我找不到使用 Selenium 接口的方法.但是,由于我使用的是 Selenium 2,我可以使用 WebDriver API,根据 http://groups.google.com/group/selenium-developers/msg/8210537dde07155f?pli=1

                  I couldn't find a way to do this using the Selenium interface. However, since I am using Selenium 2, I can use the WebDriver API, as per http://groups.google.com/group/selenium-developers/msg/8210537dde07155f?pli=1

                  在你的情况下,如果你可以升级到 Selenium 2,这样的事情可能会起作用:

                  In your case, something like this may work, if you can upgrade to Selenium 2:

                  WebDriver webDriver; 
                  ...
                  ((RenderedWebElement) webDriver.findElement(By.cssSelector("div#navi_settings"))).hover();
                  

                  这篇关于Selenium 和 :hover css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在父元素和子元素上设置 CSS 悬停效果 下一篇:动画边框底部的长度

                  相关文章

                  <small id='3gll1'></small><noframes id='3gll1'>

                1. <legend id='3gll1'><style id='3gll1'><dir id='3gll1'><q id='3gll1'></q></dir></style></legend>

                  1. <tfoot id='3gll1'></tfoot>
                    1. <i id='3gll1'><tr id='3gll1'><dt id='3gll1'><q id='3gll1'><span id='3gll1'><b id='3gll1'><form id='3gll1'><ins id='3gll1'></ins><ul id='3gll1'></ul><sub id='3gll1'></sub></form><legend id='3gll1'></legend><bdo id='3gll1'><pre id='3gll1'><center id='3gll1'></center></pre></bdo></b><th id='3gll1'></th></span></q></dt></tr></i><div id='3gll1'><tfoot id='3gll1'></tfoot><dl id='3gll1'><fieldset id='3gll1'></fieldset></dl></div>

                        <bdo id='3gll1'></bdo><ul id='3gll1'></ul>