selenium dragAndDrop not dragging and dropping, though selector seems OK - firefox

I'm trying to use dragAndDrop in the Firefox selenium IDE but it's not working.
I'm a big fan of selenium but this problem has been driving me crazy for the last day.
I have a dragAndDrop test:
dragAndDrop
//div[contains(text(),"Lori F.")]/../../
0,160
but it doesn't do the drag and drop. I have seen it work a couple of times but not sure why / why not now. Seems to sometimes work and sometimes not.
The selector itself DOES works when I click on the IDE [find] button. It highlights the DIV I am trying to move. So this is not the 'usual' problem I have in selenium of not actually being able to select the object with the right xpath.
The HTML it is going against is:
<div class="fc-event-inner fc-event-skin" style="background-color: yellow;">
<div class="fc-event-head fc-event-skin"></div>
<div class="">
<div class="fc-event-title">
Lori F., Marshal H., Chris W., Kenna T.
</div>
</div>
<div class="fc-event-bg"></div>
</div>
When that actual step tries to run, the browser does actually 'flash' the object, indicating that it's able to select it via the path OK, but the drag and drop doesn't happen.
I have tried dragAndDropToObject, using a div, but this didn't work because the DIV itself needs an x,y coordinate in order to 'land' on the right spot.
Two problems I have found [this may help other people] - and eliminated - were that 1) zooming in/out on the screen messed up the x,y coordinate for the drop, so I stopped doing that and 2) Using the element inspector in firefox seemed to also stop it working. So I believe I've eliminated both of these as potential causes.
Being able to test drag-and-drop is pretty important as many applications are now taking various ajax routes with this kinda stuff so being able to test it is key!

Sometimes drag and drop does not work properly (I don't know why).
So you may use workaround to simulate the same actions but in another way:
1) mouseDownAt(locator, coordString) - here you press down left mouse button and hold it
2) sometimes it is useful to wait for reaction (e.g. wait for tooltip appears or something else). At least put small pause to be sure that mouse "captured" the object and can drag it (tests could run very fast and browser may not react properly)
3) mouseMoveAt(locator, coordString) - drag where you need
4) mouseUpAt(locator, coordString) - release your mouse button finishing drag and drop
Also, you may add in the beginning of these steps setMouseSpeed(pixels) to make the mouse move slowly (to be sure it can drag) and in the end setMouseSpeed back to its default value (default is 10 meaning that mouse step is 10 pexels. Setting speed 3-5 pixels will make the mouse move slower).
Try to experiment with: mouse speed by setting different values and wait (after mouseDownAt) by changing locators (tooltip, shadow if there is any) or just put a pause of 1-2 seconds.

Related

Unity 5.2 Animator window / tab

When I double-click on an animator controller to launch it, the animator tab appears, but when I run the editor, I don't get the usual flow, operations, etc... I only get a static view of the states and transition arrows between them. My parameters do not show the changes they go through either.
I have multiple animations and can switch between them when certain game conditions occur, but nothing really shows when I do so, to see the flow of control, what happens, what goes wrong, the switching, the progress bar, etc...
I have the latest Unity 5.2.0f3 so I wondered if it is just me or others are having a similar problem...
What we need to do is this: Once we hit the play in the editor mode (and have the animator window docked on one side, of course) we just go and click the object in the hierarchy for which we want to analyse the animation flow. And the animator window will start showing the states and the progress bar.
Also, after upgrading to Unity 5.2, it is worth checking the values that were previously set for transition states, for example if vSpeed is greater than 0.1 then start walking. All my set values were messed up; i.e. changed.

Show hide symbol in Adobe Edge

Just trying to get my head around Adobe Edge. What I want to achieve sounds simple but having real trouble. I have a button element, that when mouseover, displays an animated symbol I have.
Currently my code,on the button is Mouseout:
sym.$("pgicatext2").hide();
and mouseover:
sym.$("pgicatext2").show();
This doesn't seem to be working. I can achieve the result if, I turn off the movie symbol, and use this code on the button
sym.$("pgicatext2").toggle();
The trouble is of course it doesn't replay the animation every time you mouse over, and all the while it's hidden it's playing the animation.
I see its been a month since you posted this. Hopefully you solved your issue. Your code for hiding and showing looks right. One thing I have had happen in some of my projects is that I inadvertently placed an object or symbol with 0% opacity on top of a button or something I had a mouse over event. Make sure that the button you have does not have anything layered on top of it. Another thing would be to turn off autoplay of your symbol, and add sym.$("pgicatext2").play(); into your mouse over. I know those are pretty obvious answers, but sometimes it is easy to forget the obvious.
Please get through following steps:
Check if the button is over all other visible layers ('Elements'
tab). Maybe setting cursor to 'pointer' will help to check it.
Use 'Mouseenter' and 'Mouseleave' instead of 'Mouseover' and
'Mouseout'. The difference is explained here.
Make sure that your animated symbols 'autoplay' option is off. If
you did not tick it off while creating the symbol, just set Playback
to 'Stop' on Stage at the very beginning of the timeline
Lets do some coding. Lets assume that your animated symbols name is
"film". You need to set following actions to your button element:
Mouseenter:
sym.$("film").show();
sym.getSymbol("film").play();
this basically shows up your 'film' element and plays 'film' symbol
Mouseleave:
sym.$("film").hide();
sym.getSymbol("film").stop(0);
this one hides your 'film' element and stops 'film' symbol at the beginning of animation (0ms)
Enjoy!

d3.event.shiftKey causing crash with Force-Directed Layout

I'm attempting to create a Shift+Click action in a force-directed layout with the following code applied to node shapes:
.on("click",function(){
if(d3.event.shiftKey){
//do something
}
});
The code tends to function correctly, but will occasionally crash the browser (both Chrome and Safari crash). It seems that the crash occurs after the following sequence:
Click and drag cursor anywhere outside of node (so that the text cursor is revealed)
Hold down shift while holding down cursor outside of node (still shows text cursor)
Click node
update: It appears that this crash is not exclusive to my code. I can crash my browsers on any force-directed layout by doing the following: while keeping shift held down the whole time, click empty space, click node.
Perhaps some built-in shift functionality is getting in the way of D3's? The alt key works fine with my above code, for instance.
Thanks!
We have run into a similar situation and it appears to be a Chrome bug: https://bugs.webkit.org/show_bug.cgi?id=114745
Its possible that the default behavior in webkit where shift-click selects all text up to current cursor position is the mechanism for the crash.
We have not spent the time to track the specifics yet in d3 but as the bug report suggests it may be possible to get around it for now with a "blur" call on any formerly focused elements (see the bug report).

FF issue with hovering on anchor rotator

Ok so this bug is very weird
here is my code, you can actually see this bug happening using fiddler
http://jsfiddle.net/LLMUX/13/
the code works fine as long as you don't go to a different tab. the code is a rotator. if you hover the links it will show the block the hover is assigned, then once you hover off it will resume the main rotation
produce the bug
- have the fiddler page open, you could copy the code into a file and try it, same thing happens
- with the fiddler page you can hover or whatever you want or do nothing
- open another tab, do whatever for a few seconds 5-10 should do
- go back to the fiddler page
- chances are you will see 2 blocks showing then eventually 1 goes away
this only happens if you are coming back from a different tab, if you stay on the page this will NEVER happen. I tried is safari, it did not happen I tried it on IE9 it did not happen! I tried this on FF 7 and 8, both with this problem.
If anyone have any idea on why this happens it would be greatly appreciated
Edit - might not happen 100% of the time
I bet your problem is the same as this: Jquery setInterval too fast when coming from another tab
Browsers try to minimize the performance hit of web pages being active when the user doesn't interact with them. One such optimization is setTimeout/setInterval "clamping": Firefox 5+ doesn't fire timeouts faster than once in 1s.
I see that your code only uses a 1300ms interval, but I guess jQuery's animation deals with being in background in a different way than your setInterval-based code does, but I'm not up to debugging this to know the exact reason it works like that.
See also Background Tab Animation and jQuery
(edit) and if I'm right, the way I'd try fixing it is to stop using setInterval to drive animation and instead to always use the jQuery's 'finished' callbacks to schedule the next slide via setTimeout: fadeIn --> wait 1s --> fade out --> fade in.

How does one use onmousedown/onmouseup correctly?

Whenever I write mouse handling code, the onmousedown/onmouseup/onmousemove model always seemed to force me to produce unnecessarily complex code that would still end up causing all sorts of UI bugs.
The main problem which I see even in major pieces of software these days is the "ghost mouse" event where you drag to outside the window and then let go. Once you return back into the window, the application still thinks you have the mouse down even though the button is up. This is especially annoying when you're trying to highlight something that goes to the border of the screen.
Is there a RIGHT way to write mouse code or is the entire model just flawed?
Ordinarily one captures the mouse events on mouse down so the mouse move and mouse up go through your code regardless of the caret moving out of you application window.
More recently this is a problem when running a VM or remote session, its difficult for apps in these to track the mouse outside of the machine screen area represented by a window on a host.
I'm not sure what environment you're attempting to track mouse buttons in, but the best way to handle this is to have a mouse listener that tracks onmouseup 100% of the time after you've detected onmousedown.
That way, it doesn't matter what screen region the user releases the mouse button in. It will reset no matter where it happens.

Resources