我对使用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