我对 Protractor 很陌生。我想明确告诉 Protractor 打开一个特定的 url 并执行一些操作。我该怎么做?
这就是我目前正在做的事情。
((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)
所以基本上我已经在一页上做了一些事情。现在,如果我想上下文切换并转到另一个 url,我该怎么做?
谢谢,
最佳答案
你可以使用 browser.get 例如;
browser.get(browser.baseurl+'/link');
引用 https://github.com/angular/protractor/blob/master/docs/tutorial.md
关于javascript - 如何转到 Protractor 中的特定链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31797957/