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


TypeScript selenium-webdriver.promise類代碼示例

本文整理匯總了TypeScript中selenium-webdriver.promise的典型用法代碼示例。如果您正苦於以下問題:TypeScript promise類的具體用法?TypeScript promise怎麽用?TypeScript promise使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: it

  it('should call execute on fulfilled executors', (done) => {
    let deferred = webdriver.promise.defer();
    var deferredExecutor = new DeferredExecutor(deferred.promise);

    deferred.fulfill(makeExecutor(done));
    deferredExecutor.execute('command');
  });
開發者ID:sjelin,項目名稱:webdriver-js-extender,代碼行數:7,代碼來源:deferredExecutor_spec.ts

示例2: buildPath

 this.schedule = (command: Command, description: string) => {
   command.setParameter('sessionId', sessionId);
   var params = command.getParameters();
   return webdriver.promise.fulfilled(execCallback(
       buildPath(this.paths_[command.getName()], params),
       description, params));
 };
開發者ID:sjelin,項目名稱:webdriver-js-extender,代碼行數:7,代碼來源:mockdriver.ts

示例3: buildPath

 execute: (command: webdriver.Command) => {
   command.setParameter('sessionId', sessionId);
   let params = command.getParameters();
   return webdriver.promise.fulfilled(execCallback(
       buildPath(paths[command.getName()], params),
       methods[command.getName()], params));
 },
開發者ID:angular,項目名稱:webdriver-js-extender,代碼行數:7,代碼來源:mockdriver.ts

示例4: navigateToCurrentUrlWithNewBrowser

    navigateToCurrentUrlWithNewBrowser(): webDriverPromise.Promise<EsfHome> {
        var esfHome2 = new EsfHome(browser.forkNewDriverInstance());
        var deferredResult = webDriverPromise.defer<EsfHome>();
        this.getCurrentUrl().then((url) => {         
            esfHome2.navigateToUrl(url);  

            deferredResult.fulfill(esfHome2);
        });
        return deferredResult.promise;
    }
開發者ID:domasmas,項目名稱:esf,代碼行數:10,代碼來源:esf.WebsiteHome.pageObject.ts

示例5: quitDrivers

 /**
  * Quits an array of drivers and returns a native promise instead of a webdriver one
  *
  * @param drivers {webdriver.WebDriver[]} The webdriver instances
  */
 static quitDrivers(provider: DriverProvider, drivers: WebDriver[]): Promise<void> {
   let deferredResolve: (x?: any) => void;
   let deferredReject: (x?: any) => void;
   let deferred = new Promise<void>((resolve, reject) => {
     deferredResolve = resolve;
     deferredReject = reject;
   });
   wdpromise.all(drivers.map((driver: WebDriver) => provider.quitDriver(driver)))
       .then(() => deferredResolve(), () => deferredReject());
   return deferred;
 }
開發者ID:NickTomlin,項目名稱:protractor,代碼行數:16,代碼來源:driverProvider.ts

示例6: _getRatesForIndicative

    private _getRatesForIndicative(skipOptionClick) {
        var promises = [];
        if (!skipOptionClick) {
            promises.push(this._waitAndClick(By.xpath(`//*[@id='nonINRradio']/*[@id='moneyType']`)));
        }
        promises.push(driver.wait(until.elementLocated(By.xpath(`//*[@id="txnAmountDiv1"]/input`)), 5 * 1000)
            .then(el => el.sendKeys('1000')));
        promises.push(this._waitAndClick(By.xpath(`//a[@onclick='calculate();']`)));

        return promise.all(promises)
            .then(_ => this._extractRates(true))
            .then(resultPromise => promise.all(resultPromise));
    }
開發者ID:vmanikandan001,項目名稱:xcngr,代碼行數:13,代碼來源:m2indiaProvider.ts

示例7: _setSearchParameters

    private _setSearchParameters(currency, transferMode, deliveryMode) {
        driver.get(URL);
        var locators = [
            By.xpath(`//*[@id='currencyId']/option[text()='${currency}'] `),
            By.xpath(`//*[@id='product']/option[text()='${transferMode}'] `),
            By.xpath(`//*[@id='deliveryMode']/option[text()='${deliveryMode}']`)];

        var promises = locators.map(locator => this._waitAndClick(locator));

        return promise.all(promises)
            .then(_ => console.log(`Search parameters currency: ${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode} set successfully`))
            .thenCatch(err => console.log(`Error while setting search parameters currency: 
                ${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode}. Error: ${err.message}`));
    }
開發者ID:vmanikandan001,項目名稱:xcngr,代碼行數:14,代碼來源:m2indiaProvider.ts

示例8: quitDrivers

 /**
  * Quits an array of drivers and returns a q promise instead of a webdriver one
  *
  * @param drivers {webdriver.WebDriver[]} The webdriver instances
  */
 static quitDrivers(provider: DriverProvider, drivers: WebDriver[]): q.Promise<void> {
   let deferred = q.defer<void>();
   wdpromise
       .all(drivers.map((driver: WebDriver) => {
         return provider.quitDriver(driver);
       }))
       .then(
           () => {
             deferred.resolve();
           },
           () => {
             deferred.resolve();
           });
   return deferred.promise;
 }
開發者ID:DylanLacey,項目名稱:protractor,代碼行數:20,代碼來源:driverProvider.ts

示例9: getElementArrayAsList

 /**
  * The given array is of promises.  Resolve those and return as an array of strings of the element.getText()
  * @param array
  * @return
  */
 public static getElementArrayAsList(array: ElementArrayFinder): promise.Promise<string[]> {
     let deferred = promise.defer();
     let out: string[] = new Array<string>();
     array.then((elements) => {
         elements.forEach((element: ElementFinder) => {
             element.getText().then(
                 (text: string) => {
                     if (text.length > 0) {
                         out.push(text);
                     }
                 }
             );
         });
     });
     deferred.fulfill(out);
     return deferred.promise;
 }
開發者ID:GeoscienceAustralia,項目名稱:gnss-site-manager,代碼行數:22,代碼來源:test.utils.ts


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