How to go to a particular link in protractor?
·
Answer a question
I'm quite new to protractor. I want to explicitly tell protractor to open a particular url and do some action. How can I do that?
This is what i am currently 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 am doing some stuff already in one page. Now if I want to context switch and go to another url how can I do that?
Thanks,
Answers
You could use browser.get eg;
browser.get(browser.baseurl+'/link');
Ref https://github.com/angular/protractor/blob/master/docs/tutorial.md
更多推荐

所有评论(0)