jasmine - How to get url of next page of clicking submit button in Protractor? -
i able run test code , able submit form. need url of next page when submit button click. need url of next page when submit button clicked. getting curenturl of first page. code:
describe('pmts app 5.0',function(){ var loginpage = require("./loginpo"); it('login test', function(){ loginpage.setusername('xyz@test.com'); loginpage.setpassword('test'); loginpage.clickbutton(); expect(browser.getcurrenturl()).toequal('https://localhost:1234/#/timesheet'); }); });
after submit button clicked browser closed , not waiting next page load. once button submitted should wait until next page load , need url of next page...
put in following way- loginpage.clickbutton().then(function(){ expect(browser.getcurrenturl()).toequal('https://localhost:1234/#/timesheet'); })
or can put explicit hard sleep- browser.sleep(time in ms)
or can put browser.wait() wait element appears on next page- browser.wait(function(){ return elem.ispresent() },time in ms).then(function(){ expect(browser.getcurrenturl()).toequal('https://localhost:1234/#/timesheet'); })
Comments
Post a Comment