Python + selenium Pyinstaller package of dependent files

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/legend818/article/details/90904087

pyinstaller pack out of the .exe file to run on a flash, through the implementation of the CMD file found here I get the file path to export a test report report copy the file to the next dist directory. Similarly, if there are some pictures path, the log file path, etc., should be the same operation.
So if this file is run to someone else, if the driver browsers exist, should the browser driver also did this directory, the same as if the browser version of someone else drive your version, should be able to, if not identical, to replace driver file, pay attention to where the browser must be specified drive

from selenium import webdriver
chromeDriverPath = r'.\tools\chromedriver.exe'
driver = webdriver.Chrome(executable_path=chromeDriverPath)
driver.get('http://www.baidu.com')

# 在这里掉了一个坑,就是这里要使用相对路径,然后打包之后,把浏览器驱动复制到对应的路径

 

How to package Look: https://blog.csdn.net/legend818/article/details/90904207 

Guess you like

Origin blog.csdn.net/legend818/article/details/90904087