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

Tec*_*ner 3 javascript jquery selenium 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)
Run Code Online (Sandbox Code Playgroud)

所以基本上我已经在一页上做了一些事情。现在,如果要上下文切换并转到另一个URL,该怎么办?

谢谢,

map*_*ap7 5

您可以使用browser.get例如;

browser.get('http://juliemr.github.io/protractor-demo/');
Run Code Online (Sandbox Code Playgroud)

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