Closed topfunet closed 1 year ago
@topfunet, thank you for creating this issue. We will troubleshoot it as soon as we can.
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template
label.
If the issue is a question, add the I-question
label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted
label.
After troubleshooting the issue, please add the R-awaiting answer
label.
Thank you!
I have the same issue, any news on this?
I have the same issue, any news on this?
I have same problem - goes OK only in console app, on Winform - hangs up
I'm also using Winforms and ran into this issue. As a workaround for now, creating a new thread and working with Selenium from there seems OK.
I have the same issue, it keeps loading forever.
Does someone know how to solve it?
ChromeOptions options = new ChromeOptions();
options.AddArguments("--start-maximized");
options.AddArguments("--test-type");
IWebDriver driver = new ChromeDriver(@"C:\Drivers\", options);
var devTools = (IDevTools)driver;
IDevToolsSession session = devTools.GetDevToolsSession();
I was also facing the same issue in my project. I don't think that app type is the problem there, the issue is the context within which you are trying to get the session with DevToolsSession session = devTools.GetDevToolsSession();
. Let me explain it on my example.
Background
I have a custom web testing framework which consist of 2 projects - Web tests project [UITests] + Selenium project [Core]. UITests is the place where I store all the tests written with Specflow library, page objects, steps implementation and all stuff related to the System Under Test [SUT]. Core is the main framework shareable between different SUT projects, it contains common logic such as WebDriver configuration and implementation, additional helper methods etc, not related to any particular SUT.
Problem As by following good coding practices, I wanted to put session initialization inside my Core project, so then it can be reusable across other projects. Because of that, I've initially placed the GetDevToolsSession() method call in main class responsible for handling WebDriver. Unfortunately it's a part of the Core project, so I was getting the same issue as described by OP, the code was just freezing without any error.
Solution For me, the solution to that problem was just simply placing GetDevToolsSession() call inside the project I originally use for running the tests, which was UITests project. I assume if all the above examples are related to multi-project solutions, then probably you're trying to call GetDevToolsSession() inside non-executable namespace, so maybe some external library project, which for selenium is a separate context for some reason. Guess this is a bug as I can easily create new driver instance, regardless the namespace or project I'm in.
do this :
DevToolsSession session; private void Button_Click(object sender, RoutedEventArgs e) { IWebDriver driver = new ChromeDriver(); IDevTools devTools = driver as IDevTools; Task.Run(() => { session = devTools.GetDevToolsSession(); }); driver.Navigate().GoToUrl("https://bing.com"); driver.Quit(); }
do this :
DevToolsSession session; private void Button_Click(object sender, RoutedEventArgs e) { IWebDriver driver = new ChromeDriver(); IDevTools devTools = driver as IDevTools; Task.Run(() => { session = devTools.GetDevToolsSession(); }); driver.Navigate().GoToUrl("https://bing.com"); driver.Quit(); }
Running on a thread does not solve the problem!
session == null
Firefox also.
do this : DevToolsSession session; private void Button_Click(object sender, RoutedEventArgs e) { IWebDriver driver = new ChromeDriver(); IDevTools devTools = driver as IDevTools; Task.Run(() => { session = devTools.GetDevToolsSession(); }); driver.Navigate().GoToUrl("https://bing.com"); driver.Quit(); }
Running on a thread does not solve the problem!
session == null
try to .Wait() on Task.Run
Should be fixed in 4.12, please verify.
Feel free to reopen this issue if it is still an issue.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What happened?
GetDevToolsSession in WPF Application hangs forever, but same code in Console Application work fine.
How can we reproduce the issue?
Relevant log output
Operating System
windows 10
Selenium version
.net c# 4.0.1
What are the browser(s) and version(s) where you see this issue?
chrome 95.0.4638.69
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 95.0.4638.5401
Are you using Selenium Grid?
no