当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser.executeScript方法代码示例

本文整理汇总了TypeScript中protractor.browser.executeScript方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.executeScript方法的具体用法?TypeScript browser.executeScript怎么用?TypeScript browser.executeScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在protractor.browser的用法示例。


在下文中一共展示了browser.executeScript方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 constructor(){
     navigateTo('/');
     browser.executeScript('window.localStorage.clear();');
     browser.executeScript('window.stop();');
     browser.sleep(1000);
     browser.waitForAngularEnabled(false);
 }
开发者ID:keviocastro,项目名称:daily-ui,代码行数:7,代码来源:login.po.ts

示例2: clearLocalStorage

export async function clearLocalStorage() {
    await navigateToRoute('/');
    await browser.executeScript(() => {
        const injector = angular.element(document.body).injector();
        const LocalStorageService: any = injector.get('LocalStorageService');
        return LocalStorageService.clearAll();
    });
    const visited = await browser.executeScript(() => {
        const injector = angular.element(document.body).injector();
        const LocalStorageService: any = injector.get('LocalStorageService');
        return LocalStorageService.get('scenariooPreviouslyVisited');
    });
    await expect(visited).toBe(null);
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例3: element

    .then((options) => {
        // Figure out which one we want
        let index = npmTiles.findIndex((tile) => tile === importOption);
        let optionElement = options[index].getWebElement();
        // Scroll into view
        browser.executeScript('arguments[0].scrollIntoView();', optionElement);

        // Click
        optionElement.click();

        // Confirm
        let confirmElement = element(by.id('import_confirm'));
        browser.executeScript('arguments[0].scrollIntoView();', confirmElement);
        OperationsHelper.click(confirmElement);
    });
开发者ID:marlonprudente,项目名称:composer,代码行数:15,代码来源:import.ts

示例4:

 return location.getWebElement().then((element) => {
     // bind a new input to the drop area
     browser.executeScript(BIND_INPUT, element).then((input) => {
       // upload the file to the new input
       (input as any).sendKeys(filePath);
   });
 });
开发者ID:GitWhiskey,项目名称:composer,代码行数:7,代码来源:fileUtils.ts

示例5: it

    it('trying to have two tabs with the same title should fail', async () => {
        let newTabBtn = element(by.id('new-tab-button'));

        // Set up two tabs
        newTabBtn.click();
        let tabs = element.all(by.css('#tab-bar .nav-item'));
        expect(await tabs.count()).toBe(2);
        expect(await tabs.get(0).getText()).toBe('Tab # 1');
        expect(await tabs.get(1).getText()).toBe('Tab # 2');

        // Rename second oab
        browser.executeScript('arguments[0].click()',
            element(by.css('#tab-bar .nav-item:last-child .edit-tab')));
        let input = element(by.css('#tab-bar .nav-item:last-child .tab-title-editor'));
        browser.wait(() => { return input.isDisplayed(); }, 1000);

        // Error status
        input.sendKeys('Tab # 1');
        input.sendKeys(protractor.Key.ENTER);
        expect(await input.getAttribute('class')).toMatch('has-error');
        expect(await input.isDisplayed()).toBe(true);

        // Esc doesn't let you leave editing
        input.sendKeys(protractor.Key.ESCAPE);
        expect(await input.isDisplayed()).toBe(true);

        // Sending a new key remove the error status
        input.sendKeys('0');
        input.sendKeys(protractor.Key.ENTER);
        expect(await input.getAttribute('class')).not.toMatch('has-error');

        let closeTabBtn = element(by.css('#tab-bar .nav-item.active .close-tab'));
        closeTabBtn.click();
    });
开发者ID:baleboy,项目名称:zephyrjs-ide,代码行数:34,代码来源:editor.component.e2e-spec.ts

示例6: retrieveEditorCodeMirrorText

 static retrieveEditorCodeMirrorText() {
   return browser.executeScript(`
       var editor = document.getElementsByClassName('CodeMirror')[0].CodeMirror;
       editor.focus();
       return editor.getValue();
   `)
 }
开发者ID:marlonprudente,项目名称:composer,代码行数:7,代码来源:editor-file.ts

示例7: enterBigConfigurationText

    enterBigConfigurationText(text) {
        let textField = element(by.css('#adf-code-configuration-editor div.overflow-guard > textarea'));
        Util.waitUntilElementIsVisible(textField);

        browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + text + '`)');
        return this;
    }
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:7,代码来源:configEditorPage.ts

示例8:

 .then(() => {
   return browser.executeScript(`
       var editor = document.getElementsByClassName('CodeMirror')[0].CodeMirror;
       editor.focus();
       return editor.setValue('');
   `)
 })
开发者ID:bloonbullet,项目名称:composer,代码行数:7,代码来源:test.ts


注:本文中的protractor.browser.executeScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。