Skip to content

Commit f02c68a

Browse files
authored
[dotnet][bidi] Remove AsBiDiContextAsync helper to avoid disposal issue (#15279)
Remove AsBiDiContextAsync helper
1 parent 173d077 commit f02c68a

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

dotnet/src/webdriver/BiDi/WebDriver.Extensions.cs

-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using OpenQA.Selenium.BiDi.Modules.BrowsingContext;
2120
using System;
2221
using System.Threading.Tasks;
2322

@@ -44,13 +43,4 @@ public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver)
4443

4544
return bidi;
4645
}
47-
48-
public static async Task<BrowsingContext> AsBiDiContextAsync(this IWebDriver webDriver)
49-
{
50-
var bidi = await webDriver.AsBiDiAsync();
51-
52-
var currentBrowsingContext = new BrowsingContext(bidi, webDriver.CurrentWindowHandle);
53-
54-
return currentBrowsingContext;
55-
}
5646
}

dotnet/test/common/BiDi/BiDiFixture.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ public async Task BiDiSetUp()
4444

4545
driver = EnvironmentManager.Instance.CreateDriverInstance(options);
4646

47-
context = await driver.AsBiDiContextAsync();
48-
bidi = context.BiDi;
47+
bidi = await driver.AsBiDiAsync();
48+
49+
context = (await bidi.BrowsingContext.GetTreeAsync())[0].Context;
4950
}
5051

5152
[TearDown]

0 commit comments

Comments
 (0)