Python 下载用于selenium测试的chrome扩展

Python 下载用于selenium测试的chrome扩展,python,selenium,groovy,google-chrome-extension,robotframework,Python,Selenium,Groovy,Google Chrome Extension,Robotframework,我正在进行selenium测试,我需要从chrome应用商店获得一个chrome扩展,以便在测试中使用。现在需要手动更新到更新版本的扩展 Current Flow: 1. Manual download extension through a chrome extension downloader. 2. Store the .crx file in a location visible to the selenium test. 3. Execute test with that ex

我正在进行selenium测试,我需要从chrome应用商店获得一个chrome扩展,以便在测试中使用。现在需要手动更新到更新版本的扩展

Current Flow:
 1. Manual download extension through a chrome extension downloader.
 2. Store the .crx file in a location visible to the selenium test. 
 3. Execute test with that extension.

我希望谷歌有一个API,可以点击,以便下载扩展,但我一直无法找到任何这样的效果。有人遇到过这样的情况并且能够解决吗?

基本上,您只需捕获重定向url,然后请求它

在python中:

pluginId=plugin页面url末尾的id。上的选项2很好地解释了这一点

blah=requests.get(url,params{'prodversion':'57.0','x':"id=pluginId",'response':'redirect'},verify=False,stream=True)

blahFile = requests.get(blah.url)

extension = open("yourExtension.crx", 'wb')
extension.write(blahFile.content)
extension.close()