如何将 URL 动态添加到 Protractor 测试中? [英] How can I add URL's dynamically to Protractor tests?

查看:42
本文介绍了如何将 URL 动态添加到 Protractor 测试中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将量角器与 Jenkins 结合使用.在我的 jenkins 中,我需要动态生成 URL.

I am trying to use protractor in conjunction with Jenkins. In my jenkins, I need to have URLs dynamically generated.

所以在运行量角器测试时,例如:

So while running protractor tests, for example:

describe('angularjs homepage', function() {
  it('should greet the named user', function() {
    // Load the AngularJS homepage.
    browser.get('http://www.angularjs.org');

    element(by.model('yourName')).sendKeys('testUser');

  });
});

在上面的例子中,我想动态地传递一个变量来代替 "http://www.angularjs.org".

In above example I want to pass a variable dynamically in place of "http://www.angularjs.org".

我也找不到任何可以在参考配置中指定的变量.

I could not find any variables that can be specified in the reference config as well.

推荐答案

如果我对问题的理解正确,您正在寻找环境变量来配置基本 url.在这种情况下,由于 Protractor 是基于 WebDriver 构建的,因此您应该能够设置

If I understand the question correctly, you are looking for the environmental variable to configure the base url. In that case, since Protractor is built on WebDriver you should be able to set

webdriver.base.url="http://someurl"

希望这就是您正在寻找的.

Hopefully this is what you are looking for.

这篇关于如何将 URL 动态添加到 Protractor 测试中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆