TypeError:无法读取未定义的属性“textToBePresentElementValue”

2024-09-30 16:40:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在我用量角器编写的非角度应用程序脚本上应用预期条件,我试图等待状态消息并获取它,但不起作用并抛出错误:

TypeError: Cannot read property 'textToBePresentInElementValue' of undefined

我的代码是:

EditContentTest.js

 "use strict";

    ddescribe( "EditContentTest", function() {

        var EditContentPage = require( "./../pages/EditContentPage.js" ),
            LoginPage = require( "./../pages/LoginPage.js" );

        beforeEach( function() {
            browser.driver.manage().window().maximize();
        enter code here

            LoginPage.logout();
            LoginPage.login();
            EditContentPage.get();
            //browser.ignoreSynchronization = true;

            //.manage().timeouts().implicitlyWait(5000);
        } );


        it( "Should remove existing Slug and Save Content", function() {
            expect( wd.getCurrentUrl() ).toEqual( baseUrl + "/en_us/content/edit/1");

            var EC = browser.ExpectedConditions;

            EditContentPage.clearInputBox( "slug" )

            EditContentPage.saveDraft();

            browser.wait(EC.textToBePresentInElementValue(EditContentPage.getStatus,'Unable to update the existing content'), 5000);


            //expect( EditContentPage.getStatus() ).toEqual( "Unable to update the existing content. Please try again." );

        } );

    } );


EditContentPage.js


"use strict";

var EditContentPage = {
    get: function() {
        wd.get( baseUrl + "/content/edit/1");
    },

    getStatus: function() {
        return wd.findElement( by.className( "error" ) ).getText();
    }
};

module.exports = EditContentPage; 

Tags: browsergetusevarjsfunctioncontentexisting