Drag and drop using uft for sapguiTree object - hp-uft

How can we drag a node in sapguitree and drop it in sapgui element?
I have tried device replay method but no luck.

Drag and drop is not allowed in SAP application when scripting is enabled. You can try recording using analog mode and playing back the track if the position of your node and element is constant. We tried this for one of our scenarios and works fine every time.

Related

How to scroll to a particular co-ordinate in Test Complete

I have spied a notepad and text box of a notepad contains a string which will be visible only if you scroll down.
Now I am trying to perform a single click there via passing a rectangle co-ordinate to the Test Complete.So with that it is able to click if it is visible on the screen otherwise it fails saying :"there was an attempt to perform an action at a point which is beyond the screen"
Is there any way where we can scroll to the point of interaction before performing the action.
I tried with following steps to achieve that but its of no help.
testObj.setFocus()
testObj.hover()
testObject.MouseWheelScroll(an integer value)
Please try this..
testObj.scrollIntoView(true);
I'm using this code and this is working fine for me..

drag and drop using selenium ruby capybara

I am trying to drag an element and drop to another element on the page. My code runs without any errors. But the drag actually doesn't happen.
It's able to find both the elements. I tried all the options listed below:
driver.browser.action.drag_and_drop(fromobject.native,
toobject.native).perform
fromobject.drag_to toobject
driver.browser.action.move_to(toobject.native).release.perform
fromobject.drag_and_drop_on toobject
If from_element.drag_to to_element doesn't work for you, then it's probably not going to be possible to do it directly with capybara/selenium. The reason for this is that drag and drop support in drivers is highly dependent on what events your code is looking for. Current versions of selenium implement it as the events mouse down, mouse move, mouse up whereas your code may be looking for drag start, drag, drag end events, etc. Because of this, to make it work you'll need to create synthetic events using execute_script to trigger the behavior you want. If you are using specific libraries someone may have already implemented this nicely for you - for instance, if you're using JQuery UI Sortable elements there is https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js

Appium: How to differentiate between two different iOS screens?

I am developing a testing algorithm for our iOS apps using Appium. To fully implement this algorithm i need to identify wither i have moved onto different screen or am still on the same screen after performing some action. I need to know, what makes every screen unique/different from other in terms of Appium?
Going through the pageSource of every screen, i found that most screens have xpath attribute in window element. Can i use value of xpath of window element to mark the screen as unique from others, or do i need to do a trivial string comparison between screen's pageSources to mark them different? Or is there any other better solution?
Not sure if xpath would be the best solution for this. Normally the UIAWindow would remain the same, and developers might use different containers within this UIAWindow to render different screens.
So to verify different screens, you might need to figure out what this container is and see if the container's properties change when you move to a new screen (ie a new container)
If you app user a different header for every new screen, then you can use this header to see if the screen is changed. Example: in WhatsApp, you would see a different persons at the top. So in this case, the person's name can be assumed as the header.
If this doesn't work then you can verify some of the other controls, or say list of all the UIAStaticText on the screen. During screen change the entire list of UIAStaticText might change. So this can indicate a screen change.
For our automation suite at work I've implemented a series of screen check steps. Every time we switch screens I do a find_element command for an element on that screen that is unique to that screen. That way if a button or option takes me to a new screen that is incorrect my test will fail as expected. If it does find the element we're expecting it adds minimal time to the test suite.
Anish Pillai made a good suggestion of using the header text if there is any. Otherwise a particular tab, menu text, resource_id, or whatever is unique about the page would suffice. All you would need to do is a find_element call and a failure message if it fails.

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).

How to make selection on QGraphicsScene?

I'm writing a diagram editor in Qt with Graphics View Framework.
Currently I'm just trying to create a simple Node (QGraphicsItem) on GraphScene (QGraphicsScene). I created a Canvas (QGraphicsView) and added a grid to it. I can even add Nodes and move them around on scene. My final goal is to have different working modes, editing and styling options, etc. For now I just want to know how can I setup selection for Nodes already present on scene. I tried doing it with mouse events but noticed that event calls for selection and Node insertion overlap... When I try to select something a new Node is created... This is my first Qt application so I don't fully understand how the functionality I want to achieve should be designed.
How the Selection Rectangle should be properly drawn?
How should I manage mouse events that conflict with each other?
You can use a checkable button/action(that's a QPushButton/QAction with a checkable property set to 'true) to switch between Edit & Insert mode. Then you check the state in your mouse event and insert a new item only if you're in Insertion mode.
You can also distinct between mouse buttons - insert item when dragged with the right button for example
Or use QKeyboardModifiers - for example: on drag + Ctrl - insert item.
Hope this helps.
In case of the overlapping mouse events, you should have a single place (like QGraphicsView to handle the mouse clicking/moving events) and create a state machine and then handle the events according to the state you are in. You need to plan your architecture well and that can be really complex task.
set your state enum/constants
refer to the current machine state in your events in your if conditions
keep your "business logic" on a single place
Like it's shown in these two NodeEditor tutorials #11 and #12: https://www.youtube.com/watch?v=pk4v2xuXlm4 and https://www.youtube.com/watch?v=-VYcQojkloE)
If you still want more in depth explanation of the functionality and events of Qt, here is a full list of tutorials with implementing all possible features like dragging edges to nodes, selecting them and deleting them, cutting edges, serialization, etc., you can have a look on the whole list of 50 tutorials I've recorded here: https://www.blenderfreak.com/tutorials/node-editor-tutorial-series/.
I'm putting a link to the whole list, since it's not possible to write all the code on this page...

Resources