Single .exe file embedding both chromedriver and geckodriver into it

0 votes

So, I have a Selenium Project in .exe form and I want the ChromeDriver and GeckoDriver files as a part of the .exe Selenium project, combining it into a single .exe file with all of it.

I think it can be done, but how?

Aug 10, 2018 in Selenium by Bharani
• 4,550 points
129 views

1 answer to this question.

0 votes
Yeah, it is possible.

You could start by adding the ChromeDriver.exe file to your Selenium project as an embedded resource. You can refer here for more details on how to do that: https://support.microsoft.com/en-us/help/319292/how-to-embed-and-access-resources-by-using-visual-c This way, the ChromeDriver.exe gets embedded into your compiled application and upon starting the application, you just have to read that embedded resource in the form of a stream of bytes and write the same to a new file and save this file with the name ChromeDriver.exe. Now, your application will invoke ChromeDriver.exe from within itself. Finally, just instantiate the ChromeDriver class and pass the path to the newly created ChromeDriver.exe file. But just embedding ChromeDriver.exe isn't enough as you'll also need all the references, including Webdriver.dll in the folder where your application is. And, .net applications get installed just by copying the folder, but not just the file. So, you can embed all needed .dlls that you need in your project and load them whenever the application starts, but that's a huge overkill for most cases. So, rather deploy a folder instead of a single file and you'll just need to add ChromeDriver.exe to that output folder (add it to your project as a content file with the Copy Always setting). And, save all the work of invoking it from the resource.
answered Aug 10, 2018 by DataKing99
• 8,130 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Selenium ChromeDriver issue - Want to run it in background, but not as headless browser

This is a flaw with ChromeDriver. Tried ...READ MORE

answered Mar 26, 2018 in Selenium by nsv999
• 5,110 points
1,202 views
0 votes
1 answer

How should I configure the chromedriver.exe in eclipse

Use the page factory pattern, working example: public ...READ MORE

answered Mar 27, 2018 in Selenium by Atul
• 5,530 points
5,133 views
0 votes
1 answer

Where do I get the ChromeDriver.exe from? The download link isn't available

You can download the chromedriver.exe from this ...READ MORE

answered Apr 3, 2018 in Selenium by nsv999
• 5,110 points
2,068 views
0 votes
1 answer

How do we use Gecko driver.exe with Selenium?

Recently Selenium launched v3 and if you ...READ MORE

answered Apr 7, 2018 in Selenium by nsv999
• 5,110 points
73 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
938 views