如何在并行测试执行中使用相同的浏览器会话id?

Prince0813
Prince0813
订阅者
285
文章
0
粉丝
测试交流评论151字数 226阅读0分45秒阅读模式
摘要我对使用Selenium运行并行UI测试有问题。在并行运行中,框架创建了Chrome驱动程序的新实例。当测试执行登录方法时,问题就开始了。所以,第一。。。

我对使用Selenium运行并行UI测试有问题。在并行运行中,框架创建了Chrome驱动程序的新实例。当测试执行登录方法时,问题就开始了。因此,第一个测试失败,因为第二个测试在创建自己的测试时会中断第一个测试的用户会话。

我要解决这个问题的观点是:获取第一个打开的浏览器的会话id,并将其并行执行到另一个浏览器实例。文章源自玩技e族-https://www.playezu.com/193637.html

还有另一个变体:在前置条件中创建登录并从驱动程序中获取cookies。但我有一些担心文章源自玩技e族-https://www.playezu.com/193637.html

我的堆栈:带NUnit的C#文章源自玩技e族-https://www.playezu.com/193637.html

基类文章源自玩技e族-https://www.playezu.com/193637.html


protected IWebDriver driver;
[SetUp]
public void InitializeBrowser()
        {
            ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.SetLoggingPreference(LogType.Browser, LogLevel.All);
            chromeOptions.AddArgument("--disable-notifications");
            chromeOptions.AddArgument("--ignore-certificate-errors");
            driver = new ChromeDriver(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, 
            "drivers"), chromeOptions);
        }
 [TearDown]
public void TearDown()
        {
         driver.Quit()  
        }

软件的测试文章源自玩技e族-https://www.playezu.com/193637.html 文章源自玩技e族-https://www.playezu.com/193637.html

 
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证