angularjs - Protractor switchTo -



angularjs - Protractor switchTo -

i have angularjs app containing iframe display page allowing log website. trying set value in fields contained in iframe can't find elements using locator.

here test :

describe("harvest", function() { beforeeach(function () { browser.get('http://localhost:8110/'); expect(browser.getcurrenturl()).tomatch('_*#/login$'); element(by.model('user.username')).sendkeys('sam'); element(by.model('user.password')).sendkeys('pass'); element(by.id('bt_signin')).click(); }); aftereach(function () { browser.executescript('window.sessionstorage.clear();'); }); describe('a user', function () { beforeeach(function () { browser.get('http://localhost:8110/'); }); it('should able obtain access token harvest', function () { expect(browser.getcurrenturl()).tomatch('_*#/home$'); //display , close window element(by.id('btharvest')).click(); expect(element(by.id('modalharvest')).ispresent()).tobe(true); element(by.id('btclosemodal')).click(); expect(element(by.id('modalharvest')).ispresent()).tobe(false); //authenticate harvest element(by.id('btharvest')).click(); expect(element(by.id('modalharvest')).ispresent()).tobe(true); browser.switchto().frame('iframeharvest'); //it fails here null exceptions, guess can't find element(by.id('email')).sendkeys(browser.params.harvestlogins.user); element(by.id('user_password')).sendkeys(browser.params.harvestlogins.password); element(by.id('sign-in-button')).click(); expect(element(by.name('commit')).ispresent()).tobe(true); browser.driver.switchto().defaultcontent(); }); }); });

and here exception generated

1) harvest user should able obtain access token harvest message: [31merror: error while waiting protractor sync page: {}[0m stacktrace: error: error while waiting protractor sync page: {} @ error (<anonymous>) ==== async task ==== webdriver.executescript() @ null.<anonymous> (/users/samdurand/workspace/cake/subbie/src/test/web/js/features/harvest.js:45:22) ==== async task ==== asynchronous test function: it() error @ null.<anonymous> (/users/samdurand/workspace/cake/subbie/src/test/web/js/features/harvest.js:26:5) @ null.<anonymous> (/users/samdurand/workspace/cake/subbie/src/test/web/js/features/harvest.js:20:3) @ object.<anonymous> (/users/samdurand/workspace/cake/subbie/src/test/web/js/features/harvest.js:1:63)

after correcting iframe phone call suggested error :

1) projects user possible create project based on harvest info message: [31merror: error while waiting protractor sync page: {}[0m stacktrace: error: error while waiting protractor sync page: {} @ error (<anonymous>)

as discussed, issue facing because iframe switching non-angular. thus, element(by.id) not work after switch iframe. instead findeement needs used!

angularjs webdriver protractor

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -