简体   繁体   English

宁静的多个浏览器实例

[英]Multiple browser instances in serenity

Serenity version: 2.6.0宁静版本: 2.6.0

I have a feature in my application in which to test the real time chat feature.我的应用程序中有一个功能可以测试实时聊天功能。 I used to open two incognito mode to test it manually but when it comes to automation, I am not sure how to achieve this?我曾经打开两个隐身模式来手动测试它但是当涉及到自动化时,我不确定如何实现这一点?

is there away to open two browser instance to test real time chatting in a single machine using SERENITY ?是否可以打开两个浏览器实例来使用SERENITY在一台机器上测试实时聊天?

if not, kindly suggest the best approach to deal with this situation like selenium grid/sauce labs.如果没有,请建议处理这种情况的最佳方法,例如 selenium grid/sauce labs。

I tried open multiple browser instance by calling open() method back to back but it just replaces the other opened.我尝试通过连续调用 open() 方法打开多个浏览器实例,但它只是替换了另一个打开的实例。

在此处输入图像描述

Expected: Two browser instances need to be opened.预期:需要打开两个浏览器实例。

Actual: One instance replaced the another.实际:一个实例替换了另一个实例。

You should use two different actors to operate with separate browsers like this:您应该使用两个不同的参与者来操作不同的浏览器,如下所示:

@Managed
WebDriver browser1;
@Managed
WebDriver browser2;

Actor user1 = Actor.named("user1");
Actor user2 = Actor.named("user2");

user1.whoCan(BrowseTheWeb.with(browser1));
user2.whoCan(BrowseTheWeb.with(browser2));

user1.attemptsTo(Open.browserOn().thePageNamed("http://gooogle.com"));
user2.attemptsTo(Open.browserOn().thePageNamed("http://gooogle.com"));

You can check here too你也可以在这里查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM