Vue 对接海康威视,实现摄像头画面展示

news2024/9/20 8:58:58

文章目录

    • 需求
    • 分析
      • 1. 下载
      • 2. 安装
      • 3. new 一个WebControl 插件相关实例

需求

项目中集成海康威视,实现摄像头画面展示

分析

1. 下载

传送门:官方插件包和文档下载
在这里插入图片描述

2. 安装

(1)下载完成后打开
在这里插入图片描述
在这里插入图片描述
(2)在项目中public文件下创建一个文件夹放视频插件js
在这里插入图片描述
在这里插入图片描述

3. new 一个WebControl 插件相关实例

  • 案例一
<template>
    <video v-resize="DomResize" :id="newId ? newId : code" autoplay></video>
</template>
 
<script>
export default {
    props: {
        streamMode: {
            type: Number,
            default() {
                return 0
            }
        },
        code: {
            type: String,
            default() {
                return ''
            }
        },
        newId: {
            type: String,
            default() {
                return ''
            }
        },
        codeList: {
            type: Array,
            default() {
                return []
            }
        },
        layout: {
            type: String,
            default() {
                return '1x1'
            }
        },
        width: {
            type: Number,
            default() {
                return 212
            }
        },
        height: {
            type: Number,
            default() {
                return 120
            }
        }
    },
    data() {
        return {
            initCount: 0,
            pubKey: '',
            oWebControl2: '',
        }
    },
    created() {
        this.$nextTick(() => {
            this.initPlugin();
        });
    },
    methods: {
        DomResize(data) {
            let { width, height } = data;
            // console.log('width:', width, 'height:', height, '   dom尺寸方式改变');
            this.init();
        },
        initPlugin() {
            let _that = this;
            let currentId = _that.newId ? _that.newId : _that.code
            const oWebControl = new window.WebControl({
                szPluginContainer: currentId, // 指定容器id
                iServicePortStart: 15900, // 指定起止端口号,建议使用该值
                iServicePortEnd: 15909,
                szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
                cbConnectSuccess() {
                    console.log('创建WebControl实例成功');
                    oWebControl.JS_StartService('window', {
                        // WebControl实例创建成功后需要启动服务
                        dllPath: './VideoPluginConnect.dll', // 值"./VideoPluginConnect.dll"写死
                    })
                    .then(
                        () => {
                            // // 启动插件服务成功
                            oWebControl.JS_SetWindowControlCallback({
                                // 设置消息回调
                                cbIntegrationCallBack: _that.cbIntegrationCallBack,
                            });
                            oWebControl.JS_CreateWnd(currentId).then(() => {
                                //JS_CreateWnd创建视频播放窗口,宽高可设定
                                _that.init(); // 创建播放实例成功后初始化
                            });
                        },
                        () => {
                            // 启动插件服务失败
                        }
                    )
                    .catch((err) => {
                        console.log(err);
                    });
                },
                cbConnectError() {
                    // 创建WebControl实例失败
                    console.log('xxx');
                    oWebControl = null;
                    $('#' + currentId).html('插件未启动,正在尝试启动,请稍候...');
                    window.WebControl.JS_WakeUp('VideoWebPlugin://'); // 程序未启动时执行error函数,采用wakeup来启动程序
                    this.initCount++;
                    if (this.initCount < 3) {
                        setTimeout(function() {
                            this.initPlugin();
                        }, 3000);
                    } else {
                        $('#' + currentId).html('插件启动失败,请检查插件是否安装!');
                    }
                },
                cbConnectClose(bNormalClose) {
                    // 异常断开:bNormalClose = false
                    // JS_Disconnect正常断开:bNormalClose = true
                    console.log('cbConnectClose');
                    oWebControl = null;
                },
            });
            this.oWebControl2 = oWebControl;
        },
        //初始化
        init() {
            let _that = this;
            this.getPubKey(function() {
                // 请自行修改以下变量值
                var appkey = "XXXXX"; //综合安防管理平台提供的appkey,必填
                var secret = _that.setEncrypt("XXXXX"); //综合安防管理平台提供的secret,必填
                var ip = "XXXXXXX"; //综合安防管理平台IP地址,必填
                var playMode = 0; //初始播放模式:0-预览,1-回放
                var port = 443; //综合安防管理平台端口,若启用HTTPS协议,默认443
                var snapDir = ""; //抓图存储路径
                var videoDir = ""; //紧急录像或录像剪辑存储路径
                var layout = _that.layout; //playMode指定模式的布局
                var enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
                var encryptedFields = "secret"; //加密字段,默认加密领域为secret
                var showToolbar = 0; //是否显示工具栏,0-不显示,非0-显示
                var showSmart = 0; //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
                var buttonIDs = ""; //自定义工具条按钮
                // 请自行修改以上变量值
                _that.oWebControl2.JS_RequestInterface({
                    funcName: "init",
                    argument: JSON.stringify({
                        appkey: appkey, //API网关提供的appkey
                        secret: secret, //API网关提供的secret
                        ip: ip, //API网关IP地址
                        playMode: playMode, //播放模式(决定显示预览还是回放界面)
                        port: port, //端口
                        snapDir: snapDir, //抓图存储路径
                        videoDir: videoDir, //紧急录像或录像剪辑存储路径
                        layout: layout, //布局
                        enableHTTPS: enableHTTPS, //是否启用HTTPS协议
                        encryptedFields: encryptedFields, //加密字段
                        showToolbar: showToolbar, //是否显示工具栏
                        showSmart: showSmart, //是否显示智能信息
                        buttonIDs: buttonIDs, //自定义工具条按钮
                    }),
                })
                .then((oData) => {
                    _that.oWebControl2.JS_Resize(_that.width, _that.height); // 初始化后resize一次,能和盒子大小一致。
                    if(_that.codeList.length > 0) {
                        for(let code of _that.codeList) {
                            _that.getVideoFun(code.cameraIndexCode)
                        }
                    }else {
                        _that.getVideoFun(_that.code)
                    }
                });
            });
        },
        // 设置窗口控制回调
        setCallbacks() {
                this.oWebControl.JS_SetWindowControlCallback({
                    cbIntegrationCallBack: this.cbIntegrationCallBack,
                });
        },
        //获取公钥
        getPubKey(callback) {
                this.oWebControl2.JS_RequestInterface({
                    funcName: "getRSAPubKey",
                    argument: JSON.stringify({
                        keyLength: 1024,
                    }),
                })
                .then((oData) => {
                    if (oData.responseMsg.data) {
                        this.pubKey = oData.responseMsg.data;
                        callback();
                    }
                });
        },
        //RSA加密
        setEncrypt(value) {
                var encrypt = new window.JSEncrypt();
                encrypt.setPublicKey(this.pubKey);
                return encrypt.encrypt(value);
        },
        //视频预览功能
        getVideoFun(Code) {
            var cameraIndexCode = Code; //获取输入的监控点编号值,必填
            var streamMode = this.streamMode; //主子码流标识:0-主码流,1-子码流
            var transMode = 1; //传输协议:0-UDP,1-TCP
            var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
            var wndId = -1; //播放窗口序号(在2x2以上布局下可指定播放窗口)
            cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
            cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
            this.oWebControl2 .JS_RequestInterface({
                funcName: "startPreview",
                argument: JSON.stringify({
                    cameraIndexCode: cameraIndexCode, //监控点编号
                    streamMode: streamMode, //主子码流标识
                    transMode: transMode, //传输协议
                    gpuMode: gpuMode, //是否开启GPU硬解
                    wndId: wndId, //可指定播放窗口
                }),
            })
            .then((res) => {
                // console.log(res, "res");
            });
        },
        // 销毁播放窗口
        destroyVideoDiv() {
            this.oWebControl2.JS_DestroyWnd()
                .then((data) => {
                    console.log("销毁窗口成功");
            })
            .catch((err) => {
                console.log("销毁窗口失败");
            });
        },
        hideVideoDiv() {
            this.oWebControl2.JS_HideWnd()
        },
        showVideoDiv() {
            this.oWebControl2.JS_ShowWnd()
        }
    }
}
</script>
  • 案例二:
<template>
  <div
    v-show="isDisplay1"
    class="container-1"
  >
    <div :id="id" class="playWnd" v-text="info" />
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    id: {
      type: String,
      default: 'playWnd'
    }
    // videoIdList: {
    //   type: Array,
    //   default: () => ([])
    // }
  },
  data() {
    return {
      oWebControl1: null,
      pubKey: '',
      info: '',
      initCount: 0,
      parentTitle: '',
      iframeClientPos: null,
      iframeParentShowSize: null,
      width: 0,
      height: 0,
      isDisplay1: true // 页面展示
    }
  },

  created() {

  },
  mounted() {
    this.isDisplay1 = true
    const demo = document.querySelector(`#${this.id}`)
    const dom = demo.getBoundingClientRect()
    this.width = dom.width
    this.height = dom.height
    this.initPlugin()
    const initParam = {
      'argument': {
        'appkey': '25329871',
        'ip': '192.168.20.253',
        'port': 443,
        'secret': 'ice4tbPdaVk1k9vX3mMK',
        'enableHTTPS': 1,
        'layout': '1x1',
        'playMode': 0,
        showSmart: 0, // 是否只能显示信息
        'wndId': -1,
        showToolbar: 0 // 是否显示工具栏
      },
      'funcName': 'init'
    }

    // jian
    const list = ['1f11869f492340b2a4911ec140cca712']
    setTimeout(() => {
    // console.log($(".container").height())
      this.requestInterface(initParam)
      // this.oWebControl1.JS_Resize($(".container").width(), $(".container").height());
      this.oWebControl1.JS_Resize(this.width, this.height)
      //
      for (let i = 0; i < list.length; i++) {
        const playParam = {
          'argument': {
            'cameraIndexCode': list[i],
            'ezvizDirect': 0,
            'gpuMode': 0,
            'streamMode': 0,
            'transMode': 1,
            'wndId': -1
          },
          'funcName': 'startPreview'
        }
        setTimeout(() => {
          this.requestInterface(playParam)
        }, 100)
      }
    }, 500)
    window.onload = () => {
      // requestInterface(initParam)
      // requestInterface( playParam)
    }
    const _this = this
    let resizeWaiter = false
    window.addEventListener('resize', function() {
      const demo = document.querySelector(`#${_this.id}`)
      const dom = demo.getBoundingClientRect()
      _this.width = dom.width
      _this.height = dom.height
      console.log(_this.width, _this.height)
      if (!resizeWaiter) {
        resizeWaiter = true
        setTimeout(function() {
          if (resizeWaiter) _this.oWebControl1.JS_Resize(_this.width, _this.height)
          resizeWaiter = false
        }, 100)
      }
    })

    // let   resizeWaiter
    //   if(!resizeWaiter){
    //       resizeWaiter = true;
    //       setTimeout(()=>{
    //           if(  resizeWaiter)        this.oWebControl1.JS_Resize(500,300);
    //           resizeWaiter = false;
    //       }, 100);
    //   }
  },
  destroyed() {
    this.destroyWnd()
    // this.oWebControl1 = null
  },
  beforeDestroy() {
    if (this.oWebControl1) {
      this.oWebControl1.JS_HideWnd()// 隐藏窗口
      // 断开链接
      this.oWebControl1.JS_Disconnect()
        .then(function() {
          console.log('断开与插件服务链接 sucess')
        },
        function() {
          console.log('断开与插件服务链接 fail')
        })
      // 销毁
      this.oWebControl1.JS_DestroyWnd()
        .then(function() {
          console.log('销毁插件 sucess')
        },
        function() {
          console.log('销毁插件 fail')
        })
      // this.oWebControl1 = null
    }
    this.isDisplay1 = false
  },

  methods: {
    destroyWnd(cb) {
      if (this.oWebControl1) {
        this.oWebControl1.JS_HideWnd()
        this.oWebControl1
          .JS_DestroyWnd({
            funcName: 'destroyeWnd'
          })
          .then(function(oData) {
          })
      } else {
        console.log('没有实例')
      }
      cb && cb()
    },
    initPlugin() {
      const _this = this
      this.oWebControl1 = new WebControl({
        szPluginContainer: _this.id,
        iServicePortStart: 15900,
        iServicePortEnd: 15900,
        szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
        cbConnectSuccess: function() {
          _this.initCount = 0
          _this.setCallbacks()
          _this.oWebControl1.JS_StartService('window', {
            dllPath: './VideoPluginConnect.dll'
          }).then(function() {
            // 步骤2:JS_CreateWnd时指定cbSetDocTitle回调,并在回调中向父页面发送更新标题消息,标题为回调出来的uuid
            _this.oWebControl1.JS_CreateWnd(_this.id, _this.width, _this.height, {
					    bEmbed: true,
              cbSetDocTitle: function(uuid) {
						  _this.oWebControl1._pendBg = false
						  window.parent.postMessage({
							  action: 'updateTitle',
							  msg: '子页面通知父页面修改title',
							  info: uuid
                }, '\*') // '\*'表示跨域参数,请结合自身业务合理设置
              }
            }).then(function() {
              // 步骤3:JS_CreateWnd成功后通知父页面将其标题修改回去
              console.log('JS_CreateWnd success')
              window.parent.postMessage({
							  action: 'updateTitle',
							  msg: '子页面通知父页面更新title',
							  info: _this.parentTitle
              }, '\*')

              // 步骤4:发消息更新插件窗口位置:这里不直接更新的原因是,父页面默认可能就存在滚动条,此时有滚动量
              window.parent.postMessage({
							  action: 'updatePos',
							  msg: '更新Pos'
              }, '\*')
            })
          }, function() {
            console.log('JS_CreateWnd fail')
          })
        },
        cbConnectError: function() {
          console.log('cbConnectError')
          _this.oWebControl1 = null
          _this.info = `插件未启动,正在尝试第${_this.initCount + 1}次启动,请稍候...`
          // $("#playWnd").html(`插件未启动,正在尝试第${this.initCount+1}次启动,请稍候...`);
          // WebControl.JS_WakeUp('VideoWebPlugin://')
          _this.initCount++
          if (_this.initCount < 3) {
            setTimeout(function() {
              _this.initPlugin()
            }, 3000)
          } else {
            // $("#playWnd").html("插件启动失败,请检查插件是否安装!");
            // window.parent.postMessage('err','*');
            _this.info = '未安装插件,请点击左侧下载插件!'
            _this.$emit('videoWebPluginMessage')
          }
        },
        cbConnectClose: function(bNormalClose) {
          // 异常断开:bNormalClose = false
          // JS_Disconnect正常断开:bNormalClose = true
          if (bNormalClose == true) {
            console.log('cbConnectClose normal')
          } else {
            console.log('cbConnectClose exception')
          }

          _this.oWebControl1 = null
          _this.info = `插件未启动,正在尝试第${_this.initCount + 1}次启动,请稍候...`
          // $("#playWnd").html(`插件未启动,正在尝试第${this.initCount+1}次启动,请稍候...`);
          // WebControl.JS_WakeUp('VideoWebPlugin://')
          _this.initCount++
          if (_this.initCount < 3) {
            setTimeout(function() {
              // 解决白块问题暂时注释掉
              // _this.initPlugin()
            }, 3000)
          } else {
          // $("#playWnd").html("插件启动失败,请检查插件是否安装!");
            // $("#playWnd").html("插件启动失败,请检查插件是否安装!");
          // window.parent.postMessage('err','*');
            _this.info = '未安装插件,请点击左侧下载插件!'

            _this.$emit('videoWebPluginMessage')
          }
        }
      })
    },
    getPubKey(callback) {
      this.oWebControl1.JS_RequestInterface({
        funcName: 'getRSAPubKey',
        argument: JSON.stringify({
          keyLength: 1024
        })
      }).then(function(oData) {
        console.log(oData)
        if (oData.responseMsg.data) {
          this.pubKey = oData.responseMsg.data
          callback()
        }
      })
    },
    setCallbacks() {
      this.oWebControl1.JS_SetWindowControlCallback({
        cbIntegrationCallBack: this.cbIntegrationCallBack
      })
    },
    cbIntegrationCallBack(oData) {
      this.showCBInfo(JSON.stringify(oData.responseMsg))
    },
    requestInterface(value) {
      this.oWebControl1.JS_RequestInterface(typeof value === 'string' ? JSON.parse(value) : value).then((oData) => {
        this.showCBInfo(JSON.stringify(oData ? oData.responseMsg : ''))
      })
    },
    showCBInfo(szInfo, type) {
      if (type === 'error') {
        szInfo = "<div style='color: red;'>" + this.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss') + ' ' + szInfo + '</div>'
      } else {
        szInfo = '<div>' + this.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss') + ' ' + szInfo + '</div>'
      }
      // $("#cbInfo").html(szInfo + $("#cbInfo").html());
    },
    dateFormat(oDate, fmt) {
      var o = {
        'M+': oDate.getMonth() + 1, // 月份
        'd+': oDate.getDate(), // 日
        'h+': oDate.getHours(), // 小时
        'm+': oDate.getMinutes(), // 分
        's+': oDate.getSeconds(), // 秒
        'q+': Math.floor((oDate.getMonth() + 3) / 3), // 季度
        'S': oDate.getMilliseconds()// 毫秒
      }
      if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (oDate.getFullYear() + '').substr(4 - RegExp.$1.length))
      }
      for (var k in o) {
        if (new RegExp('(' + k + ')').test(fmt)) {
          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
        }
      }
      return fmt
    }
  }

}
</script>

<style lang="scss" >
.container-1 {
  position: relative;
  // margin-left: -20px;
  width: 100%;
  height: 100%;
  background: transparent;
  .playWnd {
    position: absolute;
    bottom: 5px;
    height: 95%;
    width: 95%;
    background: transparent;
  }
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1937501.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

三款知名的基于RAG技术的智能体平台分析

这篇文章是关于目前市面上三款知名的基于检索增强生成&#xff08;Retrieval-Augmented Generation, RAG&#xff09;技术的智能体平台的详细对比分析。这三款产品分别是FastGPT、Dify和Coze。文章从不同维度分析了这些产品的优势和劣势&#xff0c;以供读者参考。 什么是RAG&…

【Qt之·类QRandomGenerator】

系列文章目录 文章目录 前言一、概述1.2. 二、实例演示总结 前言 一、概述 1. 2. 二、实例演示 示例1&#xff1a; #include <QRandomGenerator> #include <QRandomGenerator64> #include <QDebug>int randomInt QRandomGenerator::global()->bound…

ESP8266模块(2)

实例1 查看附近的WiFi 步骤1&#xff1a;进入AT指令模式 使用USB转串口适配器将ESP8266模块连接到电脑。打开串口终端软件&#xff0c;并设置正确的串口和波特率&#xff08;通常为115200&#xff09;。输入以下命令并按回车确认&#xff1a; AT如果模块响应OK&#xff0c;…

TCP状态转换详解

1.什么是TCP的状态转换 TCP&#xff08;Transmission Control Protocol&#xff0c;传输控制协议&#xff09;是一种面向连接的、可靠的、基于字节流的传输层协议。在 TCP 连接的生命周期中&#xff0c;连接的状态会随着不同阶段的通信而发生变化&#xff0c;这些变化被称为状…

数据库最佳实践:优化爬虫管理的数据存储方案

摘要&#xff1a; 面对日益增长的数据抓取需求&#xff0c;如何高效管理和存储爬虫获取的海量信息成为一大挑战。本文将深入探讨数据库最佳实践&#xff0c;揭示如何通过优化策略提升爬虫数据存储效率&#xff0c;助您跨越数据管理的障碍&#xff0c;实现数据价值最大化。 一、…

虚拟试衣人像合成新SOTA!IMAGDressing-v1:ControlNet和IP-Adapter的最佳拍档

文章链接&#xff1a;https://arxiv.org/pdf/2407.12705 github链接&#xff1a;https://imagdressing.github.io/ Demo试用&#xff1a;https://sf.dictdoc.site/ 亮点直击 为商家引入了一项新的虚拟试衣&#xff08;VD&#xff09;任务&#xff0c;并设计了一个综合亲和力测量…

关闭 Linux 服务器上的 IPv6

虽然 IPv6 已经逐渐普及&#xff0c;但在某些 Linux 服务器上的业务系统仍然可能遇到一些奇怪的问题。特别是在集群场景中&#xff0c;因为集群各个节点之间需要互相通信&#xff0c;如果 IPv6 没有正确配置网络&#xff0c;可能导致一些未知问题&#xff0c;解决起来相当麻烦。…

acwing796-子矩阵的和-前缀和

s矩阵是全局变量&#xff0c;维度n*m,从1~n和 1~m存储元素【0】【0】~【0】【m】和【0】【0】~【n】【0】分别存储的都是0.s矩阵刚开始是存储输入的元素&#xff0c;后面用于存储前缀和。 s矩阵的意思是s【i】【j】表示从【0】【0】到【i】【j】为对角线的矩阵里面所有元素的和…

Pytorch的编译新特性TorchDynamo的工作原理和使用示例

在深度学习中&#xff0c;优化模型性能至关重要&#xff0c;特别是对于需要快速执行和实时推断的应用。而PyTorch在平衡动态图执行与高性能方面常常面临挑战。传统的PyTorch优化技术在处理动态计算图时效果有限&#xff0c;导致训练时间延长和模型性能不佳。TorchDynamo是一种为…

AI批量剪辑,批量发布大模型矩阵系统搭建开发

目录 前言 一、AI矩阵系统功能 二、AI批量剪辑可以解决什么问题&#xff1f; 总结&#xff1a; 前言 基于ai生成或剪辑视频的原理&#xff0c;利用ai将原视频进行混剪&#xff0c;生成新的视频素材。ai会将剪辑好的视频加上标题&#xff0c;批量发布到各个自媒体账号上。这…

[CP_AUTOSAR]_通信服务_CanTp模块(二)

目录 3、功能规范3.1、提供给上层的服务3.1.1、Initialization and shutdown3.1.2、Transmit request3.1.3、Transmit cancellation 3.2、提供给下层的服务3.2.1、Transmit confirmation3.2.2、Reception indication 3.3、内部行为3.3.1、N-SDU接收 在前面 《[CP_AUTOSAR]_通信…

一款异次元小清新风格的响应式wordpress个人博客主题

一款异次元小清新风格的响应式个人博客主题。这是一款专注于用户阅读体验的响应式 WordPress 主题&#xff0c;整体布局简洁大方&#xff0c;针对资源加载进行了优化。 Kratos主题基于Bootstrap和Font Awesome的WordPress一个干净&#xff0c;简单且响应迅速的博客主题&#x…

go-微服务的设计概括

一、微服务到底是什么&#xff1f; 初学者很容易把微服务和分布式混为一谈&#xff0c;但其实二者之间存在非常大的差异&#xff0c;我个人认为主要有以下几点&#xff1a; 分布式主要是一种技术手段&#xff0c;用来保证多个相同的进程能够共同工作而不出错。采用各种复杂的…

修复公路 (最小生成树)

//新生训练 Input 4 4 1 2 6 1 3 4 1 4 5 4 2 3 Output 5 #include <iostream> #include <algorithm> #include <bits/stdc.h> using namespace std; typedef long long ll;struct road {int u,v;ll w;bool operator<(const road a)const{return w<a.w…

每日练习*

目录 一、选择题二、知识点1.中间件特点的描述1.1中间件的定义和作用1.2中间件的主要特点1.3中间件的应用场景1.4中间件的发展趋势 二、重写与重载总结![](https://i-blog.csdnimg.cn/direct/aa4190dfbd0e463294e41059016b8895.png) 一、选择题 题目选自牛客网 1.执行下列代码…

自动化测试 - selenium 环境搭建

在进行自动化测试时&#xff0c;Selenium 是一个非常强大的工具&#xff0c;在使用前需要做一些环境准备。 1. 配置 Chromedriver 访问 Chrome 浏览器的官方网站&#xff08;https://www.google.cn/chrome/&#xff09;&#xff0c;下载并安装 Chrome 浏览器。 接下来&#x…

Postman 集合变量的实用指南

在运用 Postman 进行 API 测试时&#xff0c;变量扮演着动态数据存储器的角色。它们作为键值对存在&#xff0c;其中“键”是变量的标识&#xff0c;而“值”则是存储在变量中的数据。这种机制不仅可以在多个 API 调用中重用数据&#xff0c;还有助于降低数据冗余&#xff0c;优…

【已解决】Linux(Centos7)中yum过程域名无法解析问题

问题原因 Linux中yum过程域名无法解析问题&#xff0c;但是ping 域名时联通的&#xff08;即DNS没问题&#xff09;&#xff0c;所以初步判断是镜像源的问题。 解决方法&#xff08;Centos7&#xff09; 1、备份/etc/yum.repos.d/CentOS-Base.repo 2、下载CentOS-Base.repo…

WebGL-编译报错,如何定位sendfile报错位置

1&#xff09;WebGL-编译报错&#xff0c;如何定位sendfile报错位置 2&#xff09;设置DepthBufferBits和设置DepthStencilFormat的区别 3&#xff09;Unity打包exe后&#xff0c;游戏内拉不起Steam的内购 4&#xff09;使用了Play Asset Delivery提交版本被Google报错 这是第3…

Nginx的HA高可用的搭建

1. 什么是高可用 高可用&#xff08;High Availability, HA&#xff09;是一种系统设计策略&#xff0c;旨在确保服务或应用在面对硬件故障、软件缺陷或任何其他异常情况时&#xff0c;仍能持续稳定地运行。它通过实现冗余性、故障转移、负载均衡、数据一致性、监控自动化、预防…