您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

通过python硒测试制作exe文件

通过python硒测试制作exe文件

我假设您正在使用py2exe生成exe。您需要在setup.py文件中指定Selenium Webdriver的位置。

以下代码应有所帮助:

from distutils.core import setup
import py2exe

# Change the path in the following line for webdriver.xpi
data_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,
            }
    }
)
python 2022/1/1 18:32:04 有216人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶