如何转到量角器中的特定 link?

How to go to a particular link in 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 我该怎么做?

谢谢,

你应该可以用

driver.get(url);

其中 url 是 link 您要转到的页面。

您可以使用 browser.get 例如;

browser.get(browser.baseurl+'/link');

参考 https://github.com/angular/protractor/blob/master/docs/tutorial.md