Get the current browser name in Protractor test

后端 未结 3 1714
余生分开走
余生分开走 2020-12-03 14:58

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.

3条回答
  •  -上瘾入骨i
    2020-12-03 15:06

    Another case of rubber ducking :)

    The answer was actually quite simple.

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

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

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

提交回复
热议问题