protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Can we switch to different URL without reloading the complete webpage?

Open BhupenderAgarwal opened this issue 11 years ago • 2 comments

Hi All,

I am automating application developed in AngularJS using the Protractor. I have a scenario where I have to open different pre-created documents using the URLs. Though the base url for all the documents is same but the url for page itself differs (here page corresponds to the document path). When I am switching to different documents through URL instead of just workspace the whole web-page reloads and this is causing some issues as some settings done in earlier steps are lost.

Here is how I coded: protractor's conf.js file baseUrl: 'https://abc.staging.xyz.com'

In script: browser.get('/document1');

// switch to another document browser.get('/docuemnt/testdocuemnt1')

When I perform the steps manually I just change the path for document and baseUrl remains un-touched. Doing this retains the settings made in earlier steps but the same actions I am unable to perform through protractor.

Can someone please let me know if there are any method which can just change part of url and apply changes to the workspace without loading the complete web-page.

Thanks in Advance, Bhupender Agarwal

BhupenderAgarwal avatar Aug 04 '15 13:08 BhupenderAgarwal

It sounds like you like to use browser.setLocation: http://angular.github.io/protractor/#/api?view=Protractor.prototype.setLocation

eolognt avatar Aug 04 '15 16:08 eolognt

Thank you very much eolognt. It worked like a charm !

BhupenderAgarwal avatar Aug 05 '15 11:08 BhupenderAgarwal