Tag: google chrome extension

无法使用Selenium Webdriver打开Chrome浏览器。 管理员禁用加载解压缩的扩展名

我使用Selenium Webdriver,C#,Visual Studio和Chrome浏览器自动化我的应用程序。 当selenium试图打开Chrome浏览器时,我正在低于弹出窗口。 Failed to load extension from:C:\Users\VARA~1.PAK\AppData\Local\Temp\scoped_dir6712_14913\internal. Loading of unpacked extensions is disabled by the administrator. 点击弹出窗口的确定按钮后,Chrome就会成功打开,但由于以下错误,我的测试失败了。 Test Name: _3_EnterDetailsAndSelectAnAddress_John Test FullName: Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John Test Source: : line 2147483647 Test Outcome: Failed Test Duration: 0:00:47.8059413 Result Message: Test method Veolia.BrentGWP.UserStories.Features.BrentGWPFeature._3_EnterDetailsAndSelectAnAddress_John threw exception: System.InvalidOperationException: unknown error: cannot get automation extension from unknown error: page could […]

从chrome扩展到用C#编写的本机主机的本机消息传递

我正在尝试通过本机消息传递从Chrome扩展程序接收消息。 popup.html控制台指示正在发送消息,但我的主机由于某种原因没有收到消息。 我可以看到主机native.exe正在任务管理器中启动,但主机没有收到发送的数据。 popup.js document.addEventListener(‘DOMContentLoaded’, function() { var downloadButton= document.getElementById(‘Button’); downloadButton.addEventListener(‘click’, function () { chrome.tabs.query({currentWindow: true, active: true}, function (tabs) { chrome.tabs.executeScript(tabs[0].id, {file: “myScript.js”}, function (data) { sendNativeMessage(data[0]); }); }); }); }); function sendNativeMessage(msg) { var hostName = “com.google.example”; console.log(“Connecting to host: ” + hostName); port = chrome.runtime.connectNative(hostName); message = {“text”: msg}; port.postMessage(message); console.log(“Sent message: […]

将“大量”数据从Chrome扩展程序传递到主机(用C#编写)非常慢

我正在使用Chrome的Native Messaging API将页面的DOM传递给我的主机。 当我尝试将一个小字符串从我的扩展名传递给我的主机时,一切正常,但是当我尝试传递整个DOM(不是那么大……只有大约260KB)时,一切都运行得慢得多,我最终得到了一个Native host has exited error阻止主机响应。 我的主要问题:为什么从扩展程序向主机传递250KB-350KB的消息需要这么长时间? 根据开发者的网站 : Chrome在单独的进程中启动每个本机消息传递主机,并使用标准输入(stdin)和标准输出(stdout)与其进行通信。 相同的格式用于在两个方向上发送消息:每个消息使用JSON,UTF-8编码进行序列化,并以本机字节顺序的32位消息长度开头。 来自本机消息传递主机的单个消息的最大大小为1 MB,主要是为了保护Chrome免受行为不当的本机应用程序的影响。 发送到本机消息传递主机的消息的最大大小为4 GB。 我有兴趣发送给我的主机的DOM的页面不超过260KB(有时是300KB),远低于4GB的最大值。 popup.js document.addEventListener(‘DOMContentLoaded’, function() { var downloadButton = document.getElementById(‘download_button’); downloadButton.addEventListener(‘click’, function() { chrome.tabs.query({currentWindow: true, active: true}, function (tabs) { chrome.tabs.executeScript(tabs[0].id, {file: “getDOM.js”}, function (data) { chrome.runtime.sendNativeMessage(‘com.google.example’, {“text”:data[0]}, function (response) { if (chrome.runtime.lastError) { console.log(“Error: ” + chrome.runtime.lastError.message); } […]

原生消息Chrome

我试图在我的chrome扩展和我的c#应用程序之间获取Native Messaging。 javascript工作正常,但我收到此错误: 与本机消息传递主机通信时出错。 正如我从任务管理器中看到的那样,应用程序确实与扩展一起启动。 这是我的c#代码。 private static string OpenStandardStreamIn() { //// We need to read first 4 bytes for length information Stream stdin = Console.OpenStandardInput(); int length = 0; byte[] bytes = new byte[4]; stdin.Read(bytes, 0, 4); length = System.BitConverter.ToInt32(bytes, 0); string input = “”; for (int i = 0; i > 0) & […]