How do I programmatically create a DragEvent? - html

This page describes the api for programmatically creating an event. Looking at the list, it indicates that Chrome and Safari do not support this api for creating DragEvents.
I'm trying to write automated tests for native html5 drag and drop behavior in an angular app. How can I programmatically mimic drag and drop events so I can do that?

You may want to use action chains (from selenium): https://code.google.com/p/selenium/wiki/AdvancedUserInteractions#Generating_Action_chains
We've used them on a non-angularjs app in the past for drag-drop. Anyway, as protractor (angularjs defacto tool for testing e2e apps) uses selenium webdriver, I bet you can use even protractor (https://github.com/angular/protractor) to accomplish that (with the object "browser.webdriver".
From protractors doc:
The browser.get method loads a page. Protractor expects Angular to be present on a page, so it will throw an error if the page it is attempting to load does not contain the Angular library. (If you need to interact with a non-Angular page, you may access the wrapped webdriver instance directly with browser.driver).

You're better off using the following protractor API:
https://code.google.com/p/selenium/source/browse/javascript/webdriver/actionsequence.js
You'll most likely want to use the following pattern:
browser
.actions()
.dragAndDrop(myEle, {x:100,y:100})
.perform();

Related

pywinauto: accessing chrome gui

I am trying to select a printer and print on chrome browser, using pywinauto, but I am not able to access the gui components. I can see the components in Microsoft Inspect.exe in UIAutomation mode. (See screenshot).
I have started chrome with --force-renderer-accessibility flag.
I tried several things but I am not able to access anything in the chrome window. Is it possible to access the chrome gui components using pywinauto?
screenshot: ]1
Probably you use default backend="win32" which is used when you call Application(). To use MS UI Automation you have to set backend="uia" when instantiating Application object:
app = Application(backend='uia').start('chrome.exe <other params>')
My student wrote example script dragging file from explorer.exe to Google Drive in Chrome. Is it working for you?
P.S. If you already use backend='uia', please provide more detailed description with some code and output.

How can XCUITest be used from within an OSX application to remote control iDevices?

Visionary scenario and current goal
My visionary scenario is to remotely control an non-jailbroken iDevice as lag-free as possible.
My current goal is to execute a tap on an iDevice from within an OSX application. For example: A button in a cocoa application which when clicked taps the middle of the screen on a lightning-connected iDevice.
I am not bound to OSX and am open to other avenues.
Approach
XCUITest in the XCTest framework allows to run automatic UI Tests. It is the native way of executing remote taps on iDevices.
The following line would execute a tap in the middle of the screen:
XCUIApplication().coordinateWithNormalizedOffset(CGVectorMake(0.5, 0.5)).tap()
Cheat Sheet for XCUITest: http://masilotti.com/ui-testing-cheat-sheet/
Unofficial Reference: http://masilotti.com/xctest-documentation/
Question
How can I use the XCUITest framework from within an OSX application to remotely tap a connected iDevice? I don't actually want to UI Test an existing application.
My problems start with #import XCTest which is not allowed without a test target and continue with .tap() (iOS) not being available in my cocoa application. How do integrate all this?
Other avenues
What other way should I possibly use instead? It must be possible to execute taps on a connected iDevice remotely, because Appium and Calabash use the now deprecated UIAutomation framework to do so. Both must switch to XCUITest from iOS10 onwards.
Edit 1 - Current status
It seems like my approach is much too complicated and basically means implementing Appium-light. My current approach is to use the Appium Server which handles UIAutomation (and in the future XCUITest). I then implement my own Client to send HTTP requests to the Appium REST-API.

Invoke or use Chrome Object from javascript

I'm trying to customize my own chrome://inspect/#devices , I see it uses utils.js and inspect.js and at the same time it uses a global "chrome" object in the original ones, how do I invoke it from my own inspect.js? Right know I just have a local clone:
Clone folder of chrome://inspect/#devices
devices.html
inspect.js
util.js
jquery.js
So I load devices.html but is not working, and the first obstacle I have is that global object "chrome" is not available for inspect.js.
I found a somehow related thread Can `chrome.*` extension API's be used inside content scripts?
chrome://inspect is one of the build-in Chrome pages (all are listed here - chrome://about/). These pages are considered an integral part of the browser and they have access to special actions (via chrome object). Browser will not inject chrome object into the regular pages (such as your copy of the inspect page).
Unfortunately, you won't be able to modify chrome://inspect page (even with an extension as you can't inject scripts into chrome:// pages). However, you might be able to recreate that page in an extension using debugger API.

How to get change in HTML DOM in LabVIEW?

I am doing IOT related project in Labview using Arudino as hardware.
I was able switch off/on an led on Arudino by Pressing OFF/ON on website by using datasocket vi. Now what i want is to control the intensity of led from Website.
I have a range slider in my website and its real time value can be viewed in textarea,div,input type.
Is there any way i can get that real time value that is being changed in HTML DOM in Labview.
I know that datasocket vi returns the html source code but not the HTML DOM.
I dont want to use the Web Publishing Services as they dont work in my Laptop.
This is the link im referring for datasocket.
Datasocket Labview
You can do something like creating a web socket, but I expect the easiest thing is to use a web service. You can create one in LV and add a setLEDIntensity method to it and call it from your JS code. You can find a simple example here and in other documents in that community.
Use WebSocket API for LabVIEW to send and receive data from the web. This is the best option for you.
https://decibel.ni.com/content/docs/DOC-40572

Testing a pseudo-RESTful api using node.js

I need a library that is able to simulate a browser (in that it persists cookies and session id values as a browser would) while simultaneously giving me access to the JSON strings the server returns. I need it to ignore redirects and such as well.
Is there such a tool that would allow me to use node.js and Jasmine for testing a pseudo-RESTful api?
Note: I am migrating an ancient api written in Zend 1.8 to a new api that conforms more to RESTful practices, but in doing so, I must ensure that the new api is not so different from the old that it simply does not function.
You can use Postman, this is a chrome plugin.
Postman Chrome Plugin
If you do not need to deal with the GUI side of things, simple command line curl should work. It can use cookies, take text input via command line, return the results from the server as simple text.
You do say in your question test using node.js... not sure why you would feel that you 'have' to use that to test your api.
You can use Jmeter which is open source and has user friendly GUI. You do not need any special tools.
http://jmeter-plugins.org/wiki/RESTSampler/