Make exe file from python selenium tests Make exe file from python selenium tests selenium selenium

Make exe file from python selenium tests


I am assuming you are using py2exe for generating exe. You will need to specify the location of selenium webdriver in the setup.py file.

Following code should help:

from distutils.core import setupimport py2exe# Change the path in the following line for webdriver.xpidata_files = [('selenium/webdriver/firefox', ['D:/Python27/Lib/site-packages/selenium/webdriver/firefox/webdriver.xpi'])]setup(    name='General name of app',    version='1.0',    description='General description of app',    author='author name',    author_email='author email',    url='',    windows=[{'script': 'abc.py'}],   # the main py file    data_files=data_files,    options={        'py2exe':            {                'skip_archive': True,                'optimize': 2,            }    })


Like most other binary, it's probably required to include the DLL or whatever library you need, with the binary file. For example:

C:\tests\  run_tests.exe -- this will read from webdriver.dll  selenium-webdriver.dll 

Also, from my .NET days i know that you were able to actually embed the library straight into the EXE, which makes it rather large.


You may try pyinstaller,it is simple to install and simple to use.

Install:

pip install pyinstaller

To exe:

pyinstaller yourprogram.py