简体   繁体   中英

Python selenium - compile with embedded webdriver and browser

I want to automate webpage interaction which involves clicking several buttons on the Web UI. I decided to use selenium.

Fortunately, my tests with selenium were successful. However, I will be compiling the script using pyinstaller and shipping the compiled version of the script to end users. The problem is I wouldn't know which browser they use nor can I ask them to install webdrivers.

Is there a way to embed webdriver and browser in compiled binary?

You could try to use the —add-binary argument In pyinstaller to add the chromedriver as binary and in your script call the driver (eg chromedriver) from a relative path:

webdriver.Chrome('chromedriver/path')

See pyinstaller docs for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM