That behavior is exactly the sort of thing I've seen before.. did you read the SO question and answers I linked in my prior response?
What you are describing is very typical of a CSS powered menu that uses the hover psuedoclass in CSS to control the visibility of various classes of objects such as menus. (what follows is a guess on my part based on the behavior I've seen) It seems that with IE, the browser is pretty faithful of reporting the mouse position, on a frequent basis. Such that we can briefly lie it and issue a mouseover, click etc, but if the mouse is not actually relocated over the menu then pretty much the very next opportunity it gets, the position is reported back to the CSS engine, and the hover psuedoclass is no longer applicable and the object immediately hidden. What we were trying to do with .hover was to actually issue commands to webdriver that would reposition the mouse, however that might not work in all cases. if .hover is not working, I'd suggest investigating the workaround of executing some script code on the browser that would alter the class (to make it visible) or the visibility of the element so that you will be able to click it. Or if it is a simple link, just get the URL and navigate there directly On Sunday, April 22, 2012 10:51:02 AM UTC-7, mndude wrote: > > I'm not sure if I'm quite communicating the actual problem correctly here. > So let me try to be more specific about the IE/Watir webdriver behavior. > > driver.p( :text => topmenu ).when_present.click #or .hover > > The above line executes beautifully and correctly drops down the menu so > the submenu items are visible. On the next line *of any ruby code* the > submenu disappears. So it is like it was clicked and then some other UI > action is taking place in IE which would cause the menu to disappear. > There is no similar problem in FF or Chrome - the submenu will drop down > and stay that way on the next line of ruby code until i do some Watir UI > action. > > > > On Friday, April 20, 2012 1:15:59 PM UTC-5, Chuck van der Linden wrote: >> >> well that's annoying. >> >> What platforn are you running on? If I remember right hover might depend >> on native events which is only enabled by default on windows. >> >> I think the extjs folks have a demo site, can you see if you can find >> your control on it and give us a link to that page. >> >> That would give folks something to work with. >> >> there are a few other ways you might be able to skin this particular cat, >> one thing I and others have done is using execute-script to fire off some >> jquery code that flips the visibility state of the element (same thing that >> happens when CSS see's a mouseover an triggers a :hover psuedo class to >> come into effect. Which can work great IF your site happens to be using >> jquery. >> >> Here's a link to a similar discussion from a few months back >> https://groups.google.com/d/topic/watir-general/OIpBg7iS3Wo/discussion >> >> On Thursday, April 19, 2012 8:02:33 PM UTC-7, mndude wrote: >>> >>> The "hover" method produces the same result as "click" on the top >>> menu. >>> >>> On Apr 19, 5:01 pm, Chuck van der Linden <[email protected]> wrote: >>> > if you are using watir-webdriver have you tried the 'hover' method to >>> get >>> > the dropdown to appear? >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > On Thursday, April 19, 2012 2:52:27 PM UTC-7, mndude wrote: >>> > >>> > > I have a web app with a top menu bar with drop down menus in it >>> driven >>> > > by javascript (extjs). I can easily access the menu items in >>> Firefox >>> > > and Chrome. But IE does not work the same way. The menu requires >>> > > either a mouse hover or click on the top item to drop down and then >>> a >>> > > click on the item to be selected. This is easy and fast in FF, >>> > > Chrome: >>> > >>> > > driver.p( :text => topmenu ).when_present.click >>> > > driver.a( :text => submenu ).when_present.click >>> > >>> > > In IE what happens is that the first click drops down the menu, but >>> > > then the menu disappears before the 2nd line can complete the click >>> on >>> > > the actual item to be selected. The 2nd click fails because the >>> item >>> > > is, of course, not visible. >>> > >>> > > Watir webdriver appears to not have the Selenium webdriver actions? >>> > > In Selenium webdriver I would try something like this: >>> > >>> > > driver.action.click(topmenu).click(submenu).perform >>> > >>> > > Is there a way to access the Selenium webdriver actions in Watir >>> > > webdriver? Or some other solution for IE in this situation? The >>> > > Watir browser object appears to not have an "action" set of methods. >> >> -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
