Selenium: How to use x and y coordinate position - selenium

I'm using the Selenium method mouseMoveAt(java.lang.String locator,java.lang.String coordString), which requires a coordString.
For example : coordString - x,y position (10,20). If I use 10 for x and 20 for y coordinate, what does it mean?

mouseMoveAt(E,(x,y))
This means you simulate the mouse moving to a specific (x,y) location relative to the top-left corner of element E, independent of where the element lies on screen.

Look at the org.openqa.selenium.Point class and getLocation() method of the WebElement class.
Point getLocation()
Where on the page is the top left-hand corner of the rendered element?
Returns:
A point, containing the location of the top left-hand corner of the element

Related

Nested list (tree) - how to nest elements by dragging to the right?

What would be the approach with Vue.Draggable/SortableJS in order to achieve the functionality as shown in this animated gif?
The default behavior of Sortable for nesting is to drag the element up to the above element until the mouse reaches emptyInsertThreshold pixels from the drop zone of the above element but I would like to be able to nest elements by dragging them to the right. Same for un-nesting.
I have set emptyInsertThreshold to 0 to disable the default behavior and now when I drag the element to the right I get the following events fired: clone and start (in that order).
But how do I:
Can get notified when the mouse has traveled the pre-defined distance to the right?
Inform Vue.Draggable that the ghost element should be nested as a child to the element under which I am doing the horizontal movement?
You can get the mouse position given in the start event under event.originalEvent and in the onMove event using the originalEvent argument (2nd argument). I would track the % that the mouse is past the end of the list item above the dragged item, using: (clientX - aboveItemStart) / aboveItemWidth. Then when it reaches 10% or so, change the DOM directly using event.dragged. Not sure how you would modify it to work with Vue.Draggable... you might need to edit the Vue.Draggable source.

Knob drags beyond right boundary [More 1.5.1]

When creating a nice slider using Mootools More 1.5.1 Slider class, I noticed that the 'knob' can be dragged too far to the right.
Consider this slider scenario:
|--|~|----------------|
I find I am able to do this:
|---------------------||~|
which is no good when the parent div has overflow:hidden set.
This occurs because the Drag object in the Slider class sets the left most x position ( limit.x[1] ) as the width of the passed in element (parent of the knob).
I would expect this limit to be the the element width minus the knob width.
I get the same problem whether the 'knob' is inside or outside the 'element' (above and below in the DOM).
The only way I could fix this was with a hack:
if(mySlider.drag.options.limit.x[1]===mySlider.element.getSize().x){
mySlider.drag.options.limit.x[1] -= mySlider.knob.getSize().x;
mySlider.drag.setOptions(mySlider.drag.options);
}
Check out this Fiddle (examples of broken and hacked).
Am I missing something here? Or should this be raised as a bug?

How to find the exact points that an edge connects in jgraphx?

For an edge in jgraphx which has its geometry set to relative, there are no points provided as they are derived from the source and target for the edge.
However, the points found there are the top left corner of the objects: what I would like to know is if there is a way to get the exact points in which the edge connects to the source and target vertex rather than just the position or center point of the object.
Try graph.getView().getPerimeterPoint(mxCellState, mxPoint...)
Provide as cell state your local cell (mxGraphView.getState(myLocalCell)) and as point the distant center point of your other cell linked by the edge (you may compute it from its geometry X, Y, Width and Height).
An jGraphx can be exported to svg format. Maybe the drawCell() in the com.mxgraph.canvas.mxSvgCanvas can help you out. It is the case when shape.equals(mxConstants.SHAPE_LINE) and how the M and L commands are being calculated.

JavaFx 2.x: Rectangle custom property on lower right corner

Is it possible in Rectangle class to create a doubleproperty similar to
DoubleProperty xProperty() upper-left corner but that defines the X coordinates of the lower-right corner?
Same problem for Y coordinate.
These new properties should be able to be passed as parameter to method bindDirectional.
Thanks
You can do the following, which should solve this problem.
DoubleBinding maxX = rectangle.xProperty().add(rectangle.widthProperty());
DoubleBinding maxY = rectangle.yProperty().add(rectangle.heightProperty());
otherProperty.bind(maxX);
anotherProperty.bind(maxY);
However because these properties are computed, you can't use them in bindBidirectional. The reason being that if otherProperty sets a different value for maxX JavaFX can't work out which of xProperty and widthProperty to change. You'll need to create your own property for doing that, depending on how you want changes from otherProperty to affect xProperty and widthProperty.

Zedgraph textobj X location depends on text length?

I have a Zedgraph textobj which I want to place always in the same x, y position (ASP.NET image). I noticed that the text doesn't always show in the same starting x position. It shifts depending on the text's length. I tried to have the text to have the same length by padding it with spaces. It helped a little but the result is not always consistent. I am using PaneFraction for coordType.
What's the proper method to have a piece of text to always show in the same x position. I am using textobj as a title because the native title property always shows up centered and I need my title be left aligned to the graph.
No, it does not depend on text lenght, however...
It depends on various other things:
Horizontal and vertical align of the text box (see: Location )
Current size of the pane. The font size is scaled dynamically to fit the changing size of the chart.
Counting proper positions to have TextObj (or any other object) always at the same place is quite hard. So you need avoid as much as you can any numbers/fractions in your location coordinates. ZedGraph sometimes calculates the true position in quite odd way then.
You haven't provided any code, so it's hard to tell if and where you made the mistake (if any). But, if I were you, I would do something like that:
TextObj fakeTitle = new TextObj("some title\n ", 0.0, 0.0); // I'm using \n to have additional line - this would give me some space, margin.
fakeTitle.Location.CoordinateFrame = CoordType.ChartFraction;
fakeTitle.Location.AlignH = AlignH.Left; // Left align - that's what you need
fakeTitle.Location.AlignV = AlignV.Bottom; // Bottom - it means, that left bottom corner of your object would be located at the left top corner of the chart (point (0,0))
fakeTitle.FontSpec.Border.IsVisible = false; // Disable the border
fakeTitle.FontSpec.Fill.IsVisible = false; // ... and the fill. You don't need it.
zg1.MasterPane[0].GraphObjList.Add(fakeTitle);
I'm using ChartFraction coordinates instead of PaneFraction (as drharris suggests) coordinates to have the title nicely aligned with the left border of the chart. Otherwise it would be flushed totally to the left side (no margin etc...) - it looks better this way.
But make sure you didn't set too big font size - it could be clipped at the top
Are you using this constructor?
TextObj(text, x, y, coordType, alignH, alignV)
If not, then be sure you're setting alignH to AlignH.Left and alignV to AlignV.Top. Then X and Y should be 0, 0. PaneFraction for the coordType should be the correct option here, unless I'm missing your intent.
Alternatively, you can simply download Zedgraph code, edit it to Left-align the title (or even better, provide an option for this, which should have been done originally), and then use it in production. Beauty of open source.