久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

JavaScript 未在 HtmlUnit 中正確執(zhí)行

JavaScript not being properly executed in HtmlUnit(JavaScript 未在 HtmlUnit 中正確執(zhí)行)
本文介紹了JavaScript 未在 HtmlUnit 中正確執(zhí)行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我目前正在使用 HtmlUnit 開發(fā)一些測試.它正在加載一個包含 Braintree.js(他們的表單加密庫)的頁面.我有一堆正在運行,但我被困在它稱為加密的地方.有問題的JS是:

I'm currently developing some tests with HtmlUnit. It's loading a page that contains braintree.js (their form encryption library). I have a bunch running, but I'm stuck where it calls crypto. The JS in question is:

  (function() {
        try {
            var ab = new Uint32Array(32);
            crypto.getRandomValues(ab);
            sjcl.random.addEntropy(ab, 1024, "crypto.getRandomValues");
        } catch (e) {}
    })();

HtmlUnit 正在拋出:

HtmlUnit is throwing:

EcmaError, ReferenceError, "'crypto' is not defined."

我想 HtmlUnit 不包括加密.是否可以自己包含一個加密庫?

I suppose HtmlUnit doesn't include crypto. Would it be possible to include a crypto library myself?

推薦答案

根據(jù)您的評論,我不得不告訴您,HtmlUnit 在涉及到 JavaScript 時是一個令人頭疼的問題.它會抱怨很多沒有定義的變量和未知的函數(shù)等等.

Based on your comment, I have to tell you that HtmlUnit is a pain in the neck when it comes to JavaScript. It will complain a lot about variables not being defined and unknown functions and so on.

真正的瀏覽器更靈活,例如:它們接受語法不正確的 JavaScript 片段.HtmlUnit 期望一切都是完美的,沒有任何錯誤.此外,即使您沒有錯過分號,HtmlUnit 也可能會抱怨.

Real browsers are more flexible, eg: they accept syntactically incorrect pieces of JavaScript. HtmlUnit expects everything to be perfect without any kind of error. Furthermore, even if you didn't miss a semicolon, HtmlUnit might complain.

我的建議:

  • 確保您的 JavaScript 語法正確
  • 避免使用復(fù)雜庫的用戶(jQuery 似乎得到了適當?shù)闹С?
  • 如果您可以使用非最小化版本的庫,那么值得一試
  • 盡量避免使用復(fù)雜的 jQuery 方法(例如:向元素動態(tài)添加事件)
  • 還有最重要的一點:嘗試在不同的 BrowserVersions 之間切換.事實證明,Internet Explorer(具有諷刺意味的是)在解釋 JavaScript 時提供了最佳結(jié)果
  • Make sure your JavaScript is syntactically correct
  • Avoid the user of complex libraries (jQuery seems to be properly supported)
  • If you can use non-minimized versions of libraries it's worth giving it a try
  • Try to avoid complex jQuery methods (eg: adding events dynamically to elements)
  • And the most important one: Try switching between different BrowserVersions. Internet Explorer (ironically) has proven to provide the best results when it comes to interpreting JavaScript

這篇關(guān)于JavaScript 未在 HtmlUnit 中正確執(zhí)行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Java Remove Duplicates from an Array?(Java從數(shù)組中刪除重復(fù)項?)
How to fix Invocation failed Unexpected Response from Server: Unauthorized in Android studio(如何修復(fù)調(diào)用失敗來自服務(wù)器的意外響應(yīng):在 Android 工作室中未經(jīng)授權(quán))
AES encryption, got extra trash characters in decrypted file(AES 加密,解密文件中有多余的垃圾字符)
AES Error: Given final block not properly padded(AES 錯誤:給定的最終塊未正確填充)
Detecting incorrect key using AES/GCM in JAVA(在 JAVA 中使用 AES/GCM 檢測不正確的密鑰)
AES-256-CBC in Java(Java 中的 AES-256-CBC)
主站蜘蛛池模板: 中文在线字幕免费观 | 精品九九九 | 国产精品欧美日韩 | 色吧五月天 | 二区三区视频 | 天天操天天干天天 | 小日子的在线观看免费第8集 | 国产精品一二三区 | 亚洲香蕉视频 | 日韩色在线 | 国产中文字幕av | 亚洲一区二区欧美 | 日韩欧美中文字幕在线观看 | 黄色在线免费观看视频 | 五月开心激情网 | 国产一级一片免费播放放a 男男成人高潮片免费网站 精品视频在线观看 | 日韩特黄 | 国产理论视频 | 日韩三级黄色片 | 爱爱视频网站 | 久久亚洲免费视频 | 日本少妇做爰全过程毛片 | 国产精品黄色 | 精品久久久久久久久久久久久久久久 | 在线观看av片 | 免费亚洲视频 | 国产一区二区自拍 | 亚洲三级在线 | 精品在线一区 | 日韩精品网 | 日韩在线不卡 | 91狠狠操 | 福利一区福利二区 | 天天有av| 精品视频免费 | 天天干天天爽 | 国产精品一二三四区 | 在线成人免费视频 | 美女视频一区二区 | 91免费黄 | 精品久久久久久久久久久 |