【问题标题】:Download chrome extension for selenium test下载用于硒测试的 chrome 扩展
【发布时间】:2017-03-22 15:10:28
【问题描述】:

我正在进行 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 可以被点击以下载扩展,但我一直找不到任何效果。有没有人遇到过这样的情况并且能够解决?

【问题讨论】:

    标签: python selenium groovy google-chrome-extension robotframework


    【解决方案1】:

    基本上你只需要捕获重定向 url 然后请求它。

    在python中:

    pluginId = 插件页面 url 末尾的 id。 here 上的选项 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()
    

    【讨论】:

      猜你喜欢
      • 2015-07-06
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多