當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript browser.driver.executeScript方法代碼示例

本文整理匯總了TypeScript中protractor.browser.driver.executeScript方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript browser.driver.executeScript方法的具體用法?TypeScript browser.driver.executeScript怎麽用?TypeScript browser.driver.executeScript使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在protractor.browser.driver的用法示例。


在下文中一共展示了browser.driver.executeScript方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getFile

	/**
		 * Copies a file from the device into the repository.
		 * The device file path, including root and file name, where to upload the file.
		 * The root can be phone or card Example - phone:/images/myImage.jpg
		 * repository file- The full repository path, including directory and file
		 * name, where to save the file.
		 *
		 * @author Praveen H
		 * @version 1.0
		 *
		 * @param handsetfile
		 *            : The device file path, including root and file name, where the file is located.
		 *              The root can be phone or card.
		 *              Example - phone:/images/myImage.jpg
	
		 * @param repositoryfile
		 *            : The full repository path, including directory and file name, where to save the file.
		 *              Example - PRIVATE:dir1/dir2/name.jpg
		 * @return None
		 * @see <b> Examples </b> for calling method
		 * @see 1. getFile(phone:/images/homeBtn.jpg,PRIVATE:/images/homeBtn.jpg);
		 *
		 * @see : For more information refer <a href =
		 *      https://developers.perfectomobile.com/pages/viewpage.action?pageId=14878112>getFile</a>
		 *
		 */
	getFile(handsetfile: string, repositoryfile: string) {
		var params = {
			'handsetFile': handsetfile,
			'repositoryFile': repositoryfile,
		};
		return browser.driver.executeScript('mobile:media:get', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:33,代碼來源:DeviceUtilities.ts

示例2: textCheckPoint

	/**
	 * Verifies that the given text appears on the device screen. In the case of failure, the script will be marked as failed.
	 *
	 * @author Praveen H
	 *
	 * @version 1.0
	 *
	 *
	 * @param expectedText
	 *            :The text to search for.
	 *
	 *
	 * @param threshold
	 *           : The acceptable match level percentage, between 20 and 100.
	 *            Too low values can lead to a false positive result, while too high values can lead to a false negative result.
	 *
	 *
	 *
	 * @return String value - "true" or "false"
	 *
	 * @see <b> Examples </b> for calling method
	 * @see 1. textCheckPoint("John","80");
	 * @see : For more information refer <a href=
	 *     https://developers.perfectomobile.com/pages/viewpage.action?pageId=14877166>textCheckPoint</a>
	 *
	 */
	async textCheckPoint(expectedText: string, threshold: number) {
		var params = {
			'content': expectedText,
			'threshold': threshold,
		};
		return await browser.driver.executeScript('mobile:checkpoint:text', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:33,代碼來源:UIObjectsUtilities.ts

示例3: cloudSMS

	/**
		 * Sends an SMS message to the selected destination.
		 * It is possible to select multiple destinations that may include devices, users, and phones.
		 * There is no default. To use, at least one destination must be selected.
		 * The destination phone number. It is possible to select multiple phone numbers.
		 *
		 * @author Praveen H
		 *
		 * @version 1.0
		 *
		 * @param PhoneNumber
		 *            :The destination phone number. It is possible to select multiple phone numbers, Example -  +17812054111
		 *
		 * @param Message
		 *            : The message text for this command, default body - "Test from Perfecto Mobile"
		 * @return None
		 *
		 * @see <b> Examples </b> for calling method
		 * @see 1. cloudSMS("+972541234567", "come to party at 1900");
		 * @see : For more information refer <a href=
		 *      https://developers.perfectomobile.com/pages/viewpage.action?pageId=14876831>cloudSMS</a>
		 *
		 */
	cloudSMS(PhoneNumber: string, Message: string) {
		var params = {
			'to.number': PhoneNumber,
			'body': Message
		};
		return browser.driver.executeScript('mobile:gateway:sms', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:30,代碼來源:ServicesUtilities.ts

示例4: installApplicationWithAutoAndSensorInstrument

 /**
  * Installs a single application on the device. The application should be
  * present at repositoryPath.
  * <p>To use, the application must first be uploaded to the Lab repository. PerfectoLabUtils class provides the uploadMedia method to upload a file to the Repository.
  * <p>The Install application function performs the same operation as the Install widget in Interactive
  *
  * @author Kumar L
  * @version 1.0
  *
  * @param repositoryPath
  *            : The full repository path, including directory and file name,
  *            where to locate the application.
  * @return null
  *
  * @see <b> Examples </b> for calling function
  * @see 1. installApplicationWithAutoAndSensorInstrument("PUBLIC:FingerPrint/Selendroid.apk");
  * @see 2. installApplicationWithAutoAndSensorInstrument("PUBLIC:FingerPrint/testapp.ipa");
  * @see :For more information refer <a href=
  *       http://developers.perfectomobile.com/display/PD/Install+application>installApplication1</a>,
  * <a href=
  *      https://developers.perfectomobile.com/pages/viewpage.action?pageId=14877452>installApplication2</a>
  */
 async installApplicationWithAutoAndSensorInstrument(repositoryPath: string) {
     var params = {
         'file': repositoryPath, 'instrument': 'instrument',
         'sensorInstrument': 'sensor'
     };
     return await browser.driver.executeScript('mobile:application:install', params);
 };
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:29,代碼來源:ApplicationUtilities.ts

示例5: setNetworkSettings

	/**
		 * Sets the network settings of the device.
		 * Note: Setting the Airplane mode is supported for Android devices running OS earlier than 7.0
		 *
		 * @author Praveen H
		 * @version 1.0
		 *
		 * @param Name
		 *            : The network setting property to retrieve: WiFi Data Airplane
		 *            mode
		 *
		 * @param value
		 *             :enabled | disabled
		 *
		 * @return None
		 *
		 * @see <b> Examples </b> for calling method
		 * @see 1. setNetworkSettings("wifi", "enabled");
		 * @see : For more information refer <a href=
		 *      https://developers.perfectomobile.com/pages/viewpage.action?pageId=14876786>setNetworkSettings</a>
		 *
		 */
	setNetworkSettings(Name: string, Value: string) {
		var params = {
			'name': Name,
			'value': Value,
		};
		return browser.driver.executeScript('mobile:network.settings:set', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:29,代碼來源:DeviceUtilities.ts

示例6: browserOpen

	/**
		 * Opens the browser
		 *
		 * @author Kumar L
		 * @version 1.0
		 *
		 * @param automation
		 *            : The automation mode for web applications.
		 *
		 * @see <b> Examples </b> for calling function
		 * @see 1. browserOpen(null);
		 * @see 2. browserOpen("chrome" );
		 * @see 3. browserOpen("safari" );
		 * @see 4. browserOpen("simulated");
		 *
		 * @see :For more information refer <a href=
		 *      http://developers.perfectomobile.com/display/PD/Browser+open>browserOpen</a>
		 */
	async browserOpen(automation: string) {
		var params = {};
		if (!(automation == null || automation == ''))
			params['automation'] = automation;

		return await browser.driver.executeScript('mobile:browser:open', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:25,代碼來源:BrowserUtilities.ts

示例7: startImageInjectionByIdentifier

	/**
	 * Command retrieves an image from the repository.
	 * Perfecto system supplies this image to the specified application when application tries to retrieve a camera image.
	 * The application must have been "camera instrumented" at time of installation on device.
	 * Image injection continues for this application until activating the Stop Image Injection function.
	 *
     * @author  Praveen H
     * @version  1.0
     *
      * @param  application_identifier
      *              : Identifier (BundleID for iOS or PackageName for Android) of the application.
      * @param imagePath
      *            : The full repository path, including directory and file name, where to locate the image.
      *            : Example - PUBLIC:dir1/dir2/name.png
      *
      *
      *
      * @return  None
      * @see <b> Examples </b> for calling method
      * @see 1. startImageInjectionByIdentifier("Victor.RealTimeFilter", "PUBLIC:dir1/dir2/name.png");
     * @see : For more information refer <a href = https://developers.perfectomobile.com/pages/viewpage.action?pageId=13893792>ImageInjection</a>
     *
      */
	startImageInjectionByIdentifier(application_identifier: string, imagePath: string) {
		var params = {
			'repositoryFile': imagePath,
			'identifier': application_identifier
		};
		return browser.driver.executeScript('mobile:image.injection:start', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:30,代碼來源:DeviceUtilities.ts

示例8: startImageInjectionByAppName

	/**
		 * Command retrieves an image from the repository.
		 * Perfecto system supplies this image to the specified application when application tries to retrieve a camera image.
		 * The application must have been "camera instrumented" at time of installation on device.
		 * Image injection continues for this application until activating the Stop Image Injection function.
		 *
		 * @author  Praveen H
		 * @version  1.0
		 *
		  * @param  application_Name
		  *              : Display name of the application
		  * @param imagePath
		  *            : The full repository path, including directory and file name, where to locate the image.
		  *            : Example - PUBLIC:dir1/dir2/name.png
		  *
		  *
		  *
		  * @return  None
		  * @see <b> Examples </b> for calling method
		  * @see 1. startImageInjectionByIdentifier("Victor", "PUBLIC:dir1/dir2/name.png");
		 * @see : For more information refer <a href = https://developers.perfectomobile.com/pages/viewpage.action?pageId=13893792>ImageInjection</a>
		 *
		  */
	startImageInjectionByAppName(application_Name: string, imagePath: string) {
		var params = {
			'repositoryFile': imagePath,
			'name': application_Name,
		};
		return browser.driver.executeScript('mobile:image.injection:start', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:30,代碼來源:DeviceUtilities.ts

示例9: startDeviceVitals

    /**
	 * Begins collecting Vitals, until the Vitals stop function is invoked or at
	 * script end. The selected performance data vitals are generated by the
	 * device and collected in real time. This information helps to determine
	 * how efficient an application is at using resources, as well as measuring
	 * the general device performance.
	 *
	 * @author Praveen H
	 * @version 1.0
	* @param interval
	*            : The data collection frequency, in seconds.
	*
	* @return String
	* @see <b> Examples </b> for calling method
	* @see 1. startDeviceVitals(10);
	*
	* @see : For more information refer <a href =
	*      https://developers.perfectomobile.com/pages/viewpage.action?pageId=19170124>startDeviceVitals</a>
	*
	*/
	startDeviceVitals(interval: number) {
		var params = {
			'sources': "Device",
			'interval': interval,
		};
		return browser.driver.executeScript('mobile:monitor:start', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:27,代碼來源:DeviceUtilities.ts

示例10: selectText

    /**
         * Finds text (needle) on the device screen (haystack) and clicks on it.
    	 * By default the select text function searches for the text in the current screen.
         *
    	 * @author Praveen H
    	 *
    	 * @version 1.0
    	 *
    	 * @param expectedText
    	 *            :The text to search for.
    	 *             It is recommended to use the entire string searched for, to ensure that if the OCR misses a few characters, the needle will still be found.
    	 *
    	 * @param threshold
    	 *           : The acceptable match level percentage, between 20 and 100.
    	 *            Too low values can lead to a false positive result, while too high values can lead to a false negative result.
    	 * @return None
    	 *
    	 * @see <b> Examples </b> for calling method
    	 * @see 1. selectText("John","80");
    	 * @see : For more information refer <a href=
    	 *     https://developers.perfectomobile.com/pages/viewpage.action?pageId=14877221>selectText</a>
    	 *
    	 */
	selectText(expectedText: string, threshold: number) {
		var params = {
			'content': expectedText,
			'threshold': threshold
		};
		return browser.driver.executeScript('mobile:text:select', params);
	};
開發者ID:PerfectoCode,項目名稱:Community-Samples,代碼行數:30,代碼來源:UIObjectsUtilities.ts


注:本文中的protractor.browser.driver.executeScript方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。