等待量角器与页面同步时发生错误:“ angularJS可测试性和角度可测试性均未定义

时间:2018-10-10 14:27:51

标签: typescript protractor

我已在本地安装量角器并从protractor/.bin/运行

npm run test

下面是代码:

Openpage.ts

import { browser, element, by } from 'protractor';

class Homepage{
    openbrowser(url:string){
        return browser.get(url);
    }
}
export {Homepage};

Test.ts

import { browser, element, by } from 'protractor';
import { Homepage as hp} from '../pageobjects/OpenPage';
describe('Access Angular site', () => {
    it('test', () => {
//browser.get('https://angular.io/guide/testing')
       let cc = new hp();//when I comment this and below line instead of above line it works perfectly fine.
        cc.openbrowser('https://angular.io/guide/testing');
        browser.driver.manage().window().maximize();
        element(by.xpath("/html/body/aio-shell/mat-sidenav-container/mat-sidenav/aio-nav-menu/aio-nav-item[3]/div/div/aio-nav-item[8]/div/a")).click();
        element(by.xpath("//INPUT[@aria-label='search']")).sendKeys("text");
        browser.sleep(5000);
    });

项目结构:

enter image description here

等待量角器与页面同步时出错:“ angularJS可测试性和角度可测试性均未定义。

这可能是因为这是一个非角度页面,或者是因为您的测试涉及客户端导航,这可能会干扰量角器的引导程序。

0 个答案:

没有答案