當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。