I'm struggling to make sense of the Clipboard feature of Ag-Grid. Currently, when trying to use it in Firefox (via any of the examples on the linked page), I'm getting the same error:
Uncaught TypeError: navigator.clipboard.readText is not a function
pasteFromClipboard https://www.ag-grid.com/archive/25.0.0/dev/#ag-grid-enterprise/all-modules/dist/ag-grid-enterprise.js:80812
onCtrlAndV https://www.ag-grid.com/archive/25.0.0/dev/#ag-grid-enterprise/all-modules/dist/ag-grid-enterprise.js:31893
doGridOperations https://www.ag-grid.com/archive/25.0.0/dev/#ag-grid-enterprise/all-modules/dist/ag-grid-enterprise.js:31758
processKeyboardEvent https://www.ag-grid.com/archive/25.0.0/dev/#ag-grid-enterprise/all-modules/dist/ag-grid-enterprise.js:31720
According to MDN, this method is indeed unavailable to the ordinary pages in Firefox - only to the extensions. Is there any known workaround for this issue?
Related
I am using Javascript executor to remove readonly attribute but it is giving an error.
Cannot read property 'removeAttribute' of null.
I have seen different posts where people confirm that after removing AdBlock from Chrome it worked. I don't know what is AdBlock and how to remove it from Chrome Binary at runtime, so I tried Firefox (Gecko Driver) but it is also throwing the same error.
Code:
driver.get("http://jsfiddle.net/343Rb/");
runJS().executeScript("document.getElementById('myInput').removeAttribute('readonly')");
Browsers I tried:
Chrome Binary latest, Firefox (GeckoDriver latest) on Windows 7
Links I went through:
TypeError: Cannot read property "removeAttribute" of null
Cannot read property 'removeAttribute' of null: Cant find source of it
Cannot read property *0* of null
Few posts above are purely JS based so I believe is the reason they are not replying to me.
I am using Selenium 3.0, Windows 7, Firefox, Chrome, Java, Testng
The problem is that the element you want is inside an <iframe>. You need to switch to it before querying for your element:
driver.switchTo().frame('result');
Or:
driver.switchTo().frame(driver.findElement(By.name('result')));
There's this userscript Twitter profile retweets hider (it hides retweets on Twitter profiles)
Running it in greasemonkey (3.0 in FF36) causes (in Browser Console):
TypeError: unsafeWindow.$ is not a function Twitter_pr:115:2
That's caused because of the changes to greasemonkey since v2.0, reflecting those to the Firefox (since v30) Add-on SDK:
Greasemonkey Version 2.0 Released June 17, 2014
Backwards incompatible changes:
- For stability, reliability, and security the privileged sandbox has been updated to match the new changes to unsafeWindow for the Add-on SDK.
In order to write values to unsafeWindow you will need to use the new methods cloneInto(), exportFunction(), and/or createObjectIn().
...
The function which contains the unsafeWindow command is:
window.setTimeout(function() {
addMenuItem();
unsafeWindow.$(document).on("uiPageChanged", function() {
addMenuItem();
});
}, 1);
I've already reported it to it's developer in GitHub, and the reason why I ask for your help, is that he's said that he no longer uses this userscript, so, he's either open for a pull request, or else he'll deprecate it.
I've tried a lot (with my limited javascript knowledge) to properly convert the forementioned function using either of cloneInto(), exportFunction(), and/or createObjectIn() (based on the instructions/examples on my 3rd link),
but without any success.
Edit: what I've tried so far based on Brock Adams comments:
changed unsafeWindow.$(document)... to window.$(document)...
It causes TypeError: window.$ is not a function in browser console
changed unsafeWindow.$(document)... to jQuery(document)...
It causes ReferenceError: jQuery is not defined
I have javascript error tracking on my website. Recently I started getting the following error from Chrome (versions 37 and 38) on iPhone (IOS 7 and 8):
ReferenceError: Can't find variable: __gCrWeb
I couldn't find any useful information about this error except for a few references. Has anyone seen it before and knows why it happens?
__gcrweb is a reference by gcrweb.js, which is a local (on device) js getting injected by the iOS version of Chrome.
Google needs to do this for some extended functionality (mostly inserting/retrieving login credentials and other form information you stored via another synced Chrome browser) which isn't provided by the native webview it's built on and can't be added to it otherwise.
This should not affect any parts of your code and i'd get rid of it by ignoring it in your error logging (the error should always be the same string), for example:
https://docs.sentry.io/clients/javascript/config/
https://rollbar.com/docs/notifier/rollbar.js/#ignoring-specific-exception-messages
Another solution could be to make sure that the reference always exists by declaring it yourself at the beginning of your js init
if (!window.__gCrWeb) window['__gCrWeb'] = {};
just like Google does it.
I'm assuming this is pretty obvious but I can't work it out for myself. I'm using the Facebook javascript API to allow a user to login into a page I made. The following javascript throws the error Object doesnt support this property or method. IE is saying the first line is throwing the error. Anyone know what I'm doing wrong?
document.getElementById('auth-loginlink').addEventListener('click', function () {
FB.login(function (response) {
}, {scope: 'email,user_likes,read_stream'});
The page can be accessed on http://claritytrec.ucd.ie:9000/signup
You're running your page in Quirks -mode. There must not be any characters or blank lines before declaring document type.
Only IE >= 9 knows addEventListener(), use attachEvent() instead with older IEs. attachEvent in MSDN, you can find more information about the legacy eventhandling model of IE by following left-side links at the MSDN page.
I want to use Reflect.parse in my JavaScript in Firefox.
MDN says to import this into the global object via
Components.utils.import("resource://gre/modules/reflect.jsm")
However, this results in the following error message:
Error: Permission denied for <file://> to get property XPCComponents.utils
I have tried this in Firefox 11 and Aurora.
How can I get access to Reflect.parse?
EDIT:
The error message is due to the following fragment:
Component.utils
There is no real solution to this problem. The documentation on Reflect.parse in the wiki is misleading, to say the least.
If you want a "pure" JavaScript solution in SpiderMonkey/Firefox, don't rely on Reflect.parse.
I see a lot of projects using the parser from Narcissus and I should have done the same.
EDIT: The Esprima project is an excellent implementation of the Mozilla Parser API. After replacing Reflect.parse with esprima.parse all my 150+ test cases were still green, except for 5 or so dealing with non-standard SpiderMonkey extensions like let expressions (which I find pretty impressive).