获得量角器测试当前的浏览器名称 [英] Get the current browser name in Protractor test

查看:99
本文介绍了获得量角器测试当前的浏览器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一些测试用户。由于它连接到后端,创造真正的用户,我需要的灯具。我想用的浏览器名称,以创建独特的用户的。然而,它已被证明是相当困难的得到它...

I'm creating users in some test. Since it is connected to the backend and create real users I need fixtures. I was thinking of using the browser name to create unique user. However, It has proven to be quite difficult to get to it...

任何人都可以点我在正确的方向?

Anyone can point me in the right direction?

推荐答案

回避 橡胶的另一种情况:)

Another case of rubber ducking :)

答案其实很简单。

在我的prepare功能我增加了以下功能,它完美的作品。

in my onPrepare function I added the following function and it works flawlessly.

browser.getCapabilities().then(function (cap) {
  browser.browserName = cap.caps_.browserName;
});

我可以使用 browser.browserName 在我的测试访问的名称。

I can get access the name in my test using browser.browserName.

这篇关于获得量角器测试当前的浏览器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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