Closed mgawrysiak closed 2 years ago
Thanks for your question, Opening multiple instances will cause conflicts. I need to study the reason.
Are your ChromeOptions shared? This code will add something to the options, I found a problem with sharing, try using independent options for each instance.
I think you don't understand me, in my case it is one wpf application, inside this wpf application there is one instance of undetected chromedriver. Then I run this application (app.exe) from 3 folders:
I also noticed that when I run app.exe from the App3 folder, it opens a browser with the address 'copy/BrowserProfile' (on other computers it's 'folder/BrowserProfile' or '0.0.0.2/BrowserProfile' folder) and creates browser profile files in the App 1 folder
I don't understand this
it opens a browser with the address 'copy/BrowserProfile' (on other computers it's 'folder/BrowserProfile' or '0.0.0.2/BrowserProfile' folder) and creates browser profile files in the App 1 folder
Maybe I need some screenshots.
Above screenshots are from scenario when I run app.exe from App3 folder
Thanks, is there a problem with the url of GoToUrl(url)? I suggest you can log to see.
There is no GoToUrl yet, it is just initialization of browser (GoToUrl will trigger when I click button on wpf app)
Sorry I can't reproduce, I tested with Console and everything works fine.
public static void Test()
{
var driverExecutablePath = $@"D:\xxx\chromedriver.exe";
var userDataDir =
$"{AppDomain.CurrentDomain.BaseDirectory}BrowserProfile";
using var driver = UndetectedChromeDriver.Create(
options: new ChromeOptions(),
driverExecutablePath: driverExecutablePath,
userDataDir: userDataDir);
Console.ReadLine();
}
Ok, I will prepare some demo, and will add it to my repo.
OK !!
I think of some possibilities. The code mainly uses options.Arguments to start the chrome Process. Does your option use suspicious parameters?
var info = new ProcessStartInfo(options.BinaryLocation,
string.Join(" ", options.Arguments));
// ...
var browser = Process.Start(info);
The problem was that there cannot be any spaces in userDataDir. The folder tree that I sent you before was just mockup, and in real data there was something like "C:\App - Copy\" and "C:\App1\", "C:\App2\" "C:\App 3\"
Ok, I fixed it. thanks!
Hi, in first place grate job with this!
I hope u can help me with my problem, I have code from 2 days ago. I implemented your solution into wpf app. The idea is to have many instances of that app. Each instance have its own folder with own userDataPath (I need to save some data there)
For first 2 instances it works fine, but when I try to run 3rd instance it's opening browser with some url like folder/BrowserProfile or copy/BrowserProfile or 0.0.0.2/BrowserProfile, once it opened with 2 tabs, first has url '-' and second copy/BrowserProfile.
I'm setting browser profile path like that:
var userDataPath = $"{AppDomain.CurrentDomain.BaseDirectory}BrowserProfile";
Maybe u can help me with that?