google-chrome-extension

How do I switch to the active tab in Selenium?

流过昼夜 提交于 2019-12-17 05:01:51
问题 We developed a Chrome extension, and I want to test our extension with Selenium. I created a test, but the problem is that our extension opens a new tab when it's installed, and I think I get an exception from the other tab. Is it possible to switch to the active tab I'm testing? Or another option is to start with the extension disabled, then login to our website and only then enable the extension. Is it possible? Here is my code: def login_to_webapp(self): self.driver.get(url='http://example

In a Chrome Extension content script, must I wait for document.ready before processing the document?

随声附和 提交于 2019-12-17 04:31:18
问题 Specifically, I'm evaluating all of the images on a page to see if they have a certain attribute, and then adding some new <divs> to the DOM based on those attributes. Must I wait for document.ready to fire before performing these modifications in order to be guaranteed that Chrome has loaded all of the necessary pieces of the DOM? The problem I'm running into is that sometimes document.ready takes a short while to fire and the user is already browsing around the page, wondering why my

In a Chrome Extension content script, must I wait for document.ready before processing the document?

北城余情 提交于 2019-12-17 04:31:09
问题 Specifically, I'm evaluating all of the images on a page to see if they have a certain attribute, and then adding some new <divs> to the DOM based on those attributes. Must I wait for document.ready to fire before performing these modifications in order to be guaranteed that Chrome has loaded all of the necessary pieces of the DOM? The problem I'm running into is that sometimes document.ready takes a short while to fire and the user is already browsing around the page, wondering why my

UserScripts & Greasemonkey: calling a website's JavaScript functions

南楼画角 提交于 2019-12-17 04:14:48
问题 I'm creating a UserScript extension for Firefox & Chrome and I'm trying to use some of the code in the website's JavaScript, e.g.: function: myFunction(){ return Grooveshark.playNextSong(); } The problem is when I test this code, Grooveshark is a null reference. I know there are other people who have done it: see BetterGrooveshark But I don't know why my simple extension can't call Grooveshark's JavaScript functions. Do I need to 'append' my script to the document in order for this to work?:

Console shows error about Content Security policy and lots of failed GET requests

£可爱£侵袭症+ 提交于 2019-12-17 04:07:53
问题 I'm actually working on my first Chrome Extension and even if it run smooth i got a lot of error from the get() function i'm using to retrieve some data and an annoying error about the security of the code. Here's a screenshot of the console log: Following there's the code involved: popup.html <!doctype html> <html> <head> <title>NGI Little Helper - Subscribes</title> <link rel="stylesheet" href="popup.css"> <!-- JavaScript and HTML must be in separate files for security. --> <script type=

Chrome Extension Content Script on https://chrome.google.com/webstore/

☆樱花仙子☆ 提交于 2019-12-17 03:39:30
问题 Is Chrome blocking access to the webstore url? I would like to make an extension that displays a like button beside the +1 button, but it looks like that content scripts are not working on https://chrome.google.com/webstore/* Is that true? 回答1: TL;DR The webstore cannot be scripted by extensions, and the flag that previously allowed you to do that ( --allow-scripting-gallery ) has been removed in Chrome 35. Chrome extensions cannot execute Content scripts / insert CSS the Chrome Web Store.

Upload File as a Form Data through chrome extension

旧时模样 提交于 2019-12-17 03:38:36
问题 I am uploading a file through chrome extension as a form data and my code follows below. The problem here is that the file browsing window opens for just a second and then disappears. The issue appears in Mac OS only. manifest.json: "background": { "scripts": ["jszip.js", "background.js"] }, background.js: chrome.runtime.onMessage.addListener(function (msg) { if (msg.action === 'browse') { var myForm=document.createElement("FORM"); var myFile=document.createElement("INPUT"); myFile.type="file

My CSS is not getting injected through my content script

天大地大妈咪最大 提交于 2019-12-17 03:37:11
问题 Can anyone explain this to me. I'm trying to inject a CSS file onto a webpage using the content_script with Google extensions, but my css file never gets added to the webpage. Can someone tell me what I'm doing wrong and help me fix it? thanks Manifest: { "name": "Extension", "version": "0", "description": "", "permissions": ["tabs", "http://*/*", "https://*/*", "file:///*/*"], "content_scripts": [ { "matches": [ "http://*/*", "https://*/*", "file:///*/*"], "css": ["myStyles.css"], "js": [

Detect Chrome extension first run / update

偶尔善良 提交于 2019-12-17 03:22:48
问题 How can an extension find out that it is being run for the first time or has just been updated, so that the extension can perform some specific actions? (e.g. open a help page or update settings) 回答1: In newer versions of Chrome (since Chrome 22), you can use the chrome.runtime.onInstalled event, which is much cleaner. Example: // Check whether new version is installed chrome.runtime.onInstalled.addListener(function(details){ if(details.reason == "install"){ console.log("This is a first

Injecting JS functions into the page from a Greasemonkey script on Chrome

99封情书 提交于 2019-12-17 03:01:25
问题 I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so far: First, I get a helper reference to the unsafeWindow for Firefox. This allows me to have the same code for FF and Opera (and Chrome, I thought). var uw = (this.unsafeWindow) ? this.unsafeWindow : window; Next, I inject a function into the page. It