How to navigate to a specific link in the protractor?
I'm brand new to the protractor. I want to explicitly tell the protractor to open a specific url and do some action. How can i do this?
This is what I am doing right now.
((jasmine, driver) ->
helpers = require(process.cwd() + '/../common/test/lib/helpers.coffee')
timeout = helpers.defaultTimeout
############## Test cases ##################
describe 'Going to the Connect pages and launch at dashboard', ->
it 'Should login as admin and launch Location view', ->
helpers.login(driver)
expect(driver.wait ( ->
return driver.getCurrentUrl().then (url) ->
return /map/.test(url) && /loc/.test(url)
), timeout).toBeTruthy()
it 'should navigate to the connect page and show dashboard view', ->
element(By.xpath("//a[@href='/connection/']")).click()
expect(driver.wait ( ->
return driver.getCurrentUrl().then (url) ->
return /dashboard/.test(url) && /conn/.test(url)
), timeout).toBeTruthy()
)(jasmine, browser.driver)
So basically I do some things on the same page. Now if I want to switch to context and navigate to a different url, how can I do this?
Thank,
+3
source to share
2 answers
You can use browser.get for example:
browser.get('http://juliemr.github.io/protractor-demo/');
Ref https://github.com/angular/protractor/blob/master/docs/tutorial.md
+2
source to share