appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
40 lines • 1.42 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mobileSetPasteboard = mobileSetPasteboard;
exports.mobileGetPasteboard = mobileGetPasteboard;
const lodash_1 = __importDefault(require("lodash"));
const utils_1 = require("../utils");
/**
* Sets the Simulator's pasteboard content to the given value.
*
* Does not work for real devices.
*
* @param content - The content to set
* @param encoding - The content's encoding
* @group Simulator Only
*/
async function mobileSetPasteboard(content, encoding = 'utf8') {
utils_1.assertSimulator.call(this, 'Setting pasteboard content');
if (!lodash_1.default.isString(content)) {
// can be empty string
throw new Error('Pasteboard content is mandatory to set');
}
await this.device.simctl.setPasteboard(content, encoding);
}
/**
* Gets the Simulator's pasteboard content.
*
* Does not work for real devices.
*
* @param encoding - Expected encoding of returned string
* @group Simulator Only
* @returns The pasteboard content string
*/
async function mobileGetPasteboard(encoding = 'utf8') {
utils_1.assertSimulator.call(this, 'Getting pasteboard content');
return await this.device.simctl.getPasteboard(encoding);
}
//# sourceMappingURL=pasteboard.js.map