zoukankan      html  css  js  c++  java
  • start to use await

    import { browser, $, $$, by, element, protractor } from "protractor";
    //import { SearchPageObject } from "../pages/searchPage";
    const { When, Then } = require("cucumber");
    const { Given } = require("cucumber");
    var chai = require('chai');
    var retry = require('retry');
    var chaiAsPromised = require('chai-as-promised');
    var count2 = 1;
    chai.use(chaiAsPromised);
    var expect = chai.expect;
    When(/^I type "(.*?)"$/, async (text) => {
    await browser.waitForAngularEnabled(false);
    await browser.driver.get('https://www.baidu.com');
    await $('#kw').sendKeys('protractor');
    await $('#su').click();
    });
    Then(/^I click on search button$/, { timeout: 60 * 1000 }, async () => {
    //browser.actions().sendKeys(protractor.Key.ENTER).perform();
    console.info(" ");
    var EC = protractor.ExpectedConditions;
    await browser.wait(EC.presenceOf($('.result.c-container h3')), 500000);
    var s = $$('.result.c-container h3');
    await s.each(async p => { console.log( (count2++)+ "->" + await p.getText())});
     
    async function getOneItem(f) {
    return console.log( (count2++)+ "->" + await f.getText());
    }
    });
    Given(/^I am on google page$/, () => {
    //browser.driver.get('https://wwww.baidu.com');
    });



    });
    });
    }
  • 相关阅读:
    创建二叉树
    并查集
    opn模块
    【ES6】map、reduce、filter、sort、箭头函数、class继承、yield
    css应用视觉设计
    json解决ajax跨域的原理
    flex盒子布局
    前后台交互ajax请求模块
    react后台项目开发(一)
    高阶函数&&高阶组件(二)
  • 原文地址:https://www.cnblogs.com/wblade/p/8861335.html
Copyright © 2011-2022 走看看