Closed nolme closed 3 months ago
Could you please attach a trace-level log from geckodriver? Read more about reporting actionable bugs in our contribution guidelines.
No reply from reporter in 2 weeks. Closing issue as incomplete.
Sorry to be late. Here is the sample code : ` namespace ConsoleApp { using System; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Internal.Logging; using OpenQA.Selenium.Remote;
internal class Program
{
static void Main(string[] args)
{
string url = "https://www.google.fr";
try
{
Log.Handlers.Add(new FileLogHandler(Environment.ExpandEnvironmentVariables(@"%TEMP%\HotspotShield.log")));
Log.SetLevel(LogEventLevel.Trace);
Log.SetLevel(typeof(RemoteWebDriver), LogEventLevel.Trace);
Log.SetLevel(typeof(SeleniumManager), LogEventLevel.Trace);
var options = new FirefoxOptions();
options.SetPreference("webdriver.gecko.driver", @"D:\geckodriver.exe");
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
options.SetLoggingPreference(LogType.Driver, LogLevel.All);
options.SetLoggingPreference(LogType.Performance, LogLevel.All);
Console.WriteLine($"Init Firefox driver.");
using IWebDriver driver = new FirefoxDriver(options);
Console.WriteLine($"Go to URL : {url}");
driver.Navigate().GoToUrl(new Uri(url));
driver.Navigate().Refresh();
}
catch (Exception ex)
{
Console.WriteLine($"ERROR : {ex}");
}
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
} `
And here are the log with the VPN opened (non working code) and closed (working code) HotspotShield_error.log HotspotShield_ok.log .
I still don't see on which port geckodriver is running. Also please attach the trace level logs from geckodriver and not some logs from Selenium. Maybe use plain HTTP requests via curl
to check the connection to geckodriver.
:/ I need a bit more help to generate logs. Is there a way to make a .BAT to run geckodriver (using param -vv for the logs ?) and open firefox to www.google.fr ? This way we are not using C# & Selenium.
Meanwhile I made another try. I ran the program with VPN opened. It was stuck on first line. Firefox not launched.
Then I close the VPN and immediatly I got the other lines.
There is always a way to create your own bat file. Just pass the right arguments to the Firefox binary.
For further investigation more logs from geckodriver would be great to have. Otherwise it's hard to figure out what's wrong.
PS: Maybe you could use a tool like Wireshark to also check if some network request is stalled waiting for a reponse that doesn't get send. But again it's hard to say.
Looks very hard to get logs :/
I tried this batch but it doesn't reproduce the problem :
start /B "" "geckodriver.exe" -vv %* >c:\Temp\gecko.log
timeout /t 5 /nobreak
"C:\Program Files\Mozilla Firefox\firefox.exe" "--marionnette" -no-remote -url "www.google.Fr"
echo Appuyez sur une touche pour fermer Geckodriver et quitter.
pause > nul
taskkill /f /im geckodriver.exe
Nobody seems to use a BAT to do this :(
Maybe use plain HTTP requests via
curl
to check the connection to geckodriver.
I would then suggest to use the above to check outside of VSCode as well. That should also give proper logs in case the problem is reproducible. Here the steps:
curl
installed-vvv
argument in a command linecurl -H 'Content-Type: application/json' -d '{"capabilities": {"alwaysMatch": {}}}' http://localhost:4444/session
Run step 3 with and without your VPN enabled. The log output I'm interested should be visible in the command line where geckodriver is running.
I tried your command and get errors : curl: (6) Could not resolve host: application curl: (3) unmatched brace in URL position 1: {alwaysMatch: ^
Looks like you accidentally removed one or more quotes. Make sure that you run exactly what I added above. application
is part of a string that is passed as extra HTTP header.
Here is the code I copy / paste :
Maybe your shell doesn't understand single quotes? Please try other variations.
Closing as incomplete because of a missing reply from the reporter, but happy to reopen if more details are provided, which demonstrate that this is an issue with geckodriver or Firefox.
I was able to run the command. :)
Batch file :
start /B "" "geckodriver.exe" -vvv %* >c:\Temp\gecko.log
timeout /t 1 /nobreak
curl -H "Content-Type: application/json" --data-binary "@request.json" http://localhost:4444/session
JSON file :
{
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"moz:firefoxOptions": {
"binary": "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
"log": { "level": "trace" },
"args": ["https://www.google.fr"],
"prefs": {
"browser.startup.homepage": "https://www.google.fr"
}
}
}
}
}
I check all is working without the VPN : gecko OK.log
Then I opened the VPN gecko Error.log
I see 1 line. and in the console I have a message : "curl: (55) Send failure: Connection was aborted"
As it looks like geckodriver hasn't received the new session command. Could you maybe run a tool like Wireshark to record the network requests as made by curl? It seems like that this might indeed be a network issue.
Btw. does Hotspot shield actually allow exclude local addresses so that you can still connect to eg. your router interface? Maybe try with 127.0.0.1
instead?
You last suggestion was the good one. Hotspot shield don't let access to LAN by default. I check the option and all is working now. Thanks for help :)
Fantastic! Good that we got it solved.
System
Testcase
When Hotspot shield is running but VPN not opened. This code works :
using IWebDriver driver = new FirefoxDriver();
Once VPN is opened. This code throw a WebDriverException : Cannot start the driver service on http://localhost:55945 Other application are working well (Outlook, web) If I close the VPN tunnel, code works again.