【问题标题】:How to embed base64 encoder into html file using vbscript?如何使用 vbscript 将 base64 编码器嵌入到 html 文件中?
【发布时间】:2015-01-28 11:04:00
【问题描述】:

问题 1)我已将图像转换为 base64 编码器,现在我想使用 vbscript 将其嵌入到 html 文件中。

问题2)我想点击一个单词,它会像如何打开这个编码图像一样
“a href”有效。我只想在单击链接时查看图像。

我的第一个问题得到了答案。谁能帮我解决第二个问题?

提前感谢。

【问题讨论】:

标签: vbscript hp-uft


【解决方案1】:

您可以使用 UFT 的 RunScript 功能来执行此操作。

假设您有一个名为 addImage.js 的文件(我不知道您要在哪里插入 img 我假设您可以通过某种方式识别该对象,此示例假设为 id)。

window.addImageToId = function(id, base64) {        
    var img = document.createElement('img');
    img.src = "data:image/png;base64," + base64;
    var parent = document.getElementById(id);
    parent.appendChild(img)
}

那么你就可以在测试中这样做了。

'# introduce the function into the document's scope
Browser("B").Page("P").RunScriptFromFile "C:\addImage.js" 
Browser("B").Page("P").RunScript "addImageToId('" & theId & "', '" & theBase64 & "')"

【讨论】:

  • @user90,如果这回答了你的问题,请考虑接受答案(点击分数下方的勾号)
猜你喜欢
  • 1970-01-01
  • 2017-12-27
  • 2021-02-11
  • 1970-01-01
  • 2011-08-08
  • 2017-02-27
  • 1970-01-01
  • 1970-01-01
  • 2015-10-14
相关资源
最近更新 更多