Goal: I want to run an experiment in which I will open a list of websites and want to collect the scripts that are parsed on those websites. The way I plan to do is as follows:
using selenium webdriver I will open each website in chrome.
using chrome.debugger api I will attach a debugger and listen to Debugger.Scriptparsed event.
Problem: When I open a website in a chrome (loaded with my extension ) with selenium, it throws an error that another debugger is also attached to tab. I read here, it states that selenium webdriver is using debugger also. In that case is there a way to use these functions with selenium webdriver for chrome only?
Yes, the webdriver itself is working through the debugging protocol and you cannot use the chrome.debugger API or open the developer tools in the browser that is automated with selenium.
Is there a way to detect where a chrome extension installation was referred from. In case you want to rebrand the extension based on where the user came from
Android Apps are capable of this using intent com.android.vending.INSTALL_REFERRER and a referrer=something querystring on their Google Play URL, but I've been unable to find anything similar for Chrome Extensions.
I can probably do a 80% solution with cookies and redirects but it would be nice if this worked as cleanly as in Android INSTALL_REFERRER
It seems that there is no referrer option for Chrome Extensions and it is not listed in the documentation. See the following link for the closest I've found.
https://developer.chrome.com/extensions/runtime#type-OnInstalledReason
A workaround for this would be to pull the data from Google Analytics using the API. Referrals are recorded in Google Analytics for my Chrome Extension:
Is there a way to initiate translating current page in google chrome using selenium?
This is different from changing preference which translates all pages nor setting -lang as command line argument which changes google chrome's language.
I want to translate page on-demand based on the url.
I am using chromedriver + selenium web driver for c#
Thanks
You can use https://chrome.google.com/webstore/detail/google-translate/aapbdbdomjkkjkaonfhkkikfgjllcleb?hl=en google chrome extension to fulfill your requirement. You can automate this utility using autoit.
To add an extension for chrome driver please refer to this link:
HOW TO CREATE .CRX FILE FROM ALREADY INSTALLED CHROME EXTENSION?
HOW TO ADD AN EXTENSION TO GOOGLE CHROME INSTANCE OF SELENIUM WEBDRIVER?
I'm trying to register a chrome app to get a registration id so I test but the chrome javascript console is showing:
Uncaught TypeError: Cannot read property 'register' of undefined
I don't know what's wrong. I got the example from: https://github.com/GoogleChrome/chrome-app-samples#push-messaging
Seems your Chrome APIs are not loaded.
You need to make sure your Chrome APIs are loaded in order to use the push messaging methods.
In order to load the Chrome APIs correctly, follow the step 5 in Chrome developer page to launch your app or extension. For some newer Chrome browser, you can go to Settings -> Extensions -> Load unpacked extension
Had the same problem,
Eventually the problem was that content scripts cannot use a lot of chrome.* APIs.
GCM is one of them.
Source
I am trying to create a web page, which embeds several Google Docs in it. My problem is that when this page is viewed on an android device, then the user is presented with the terrible web based Google Docs editor. Therefore, I would like to have a link on my page, which opens the native Google Drive app on the users phone, so he/she can edit the document there. After searching for two hours, I am unable to figure out how to make a link, which automatically opens the document in the native app.
I succeeded with viewing the Google Drive app in google market using the following link:
market://details?id=com.google.android.apps.docs
I also experimented with
googledrive://no-idea-what-to-write-here
But that did not succeed either.
Is this possible at all, or does this only work on iOS?
There does not seem to be a good way to do what you want (at least according to my testing with Android 4.0.4; maybe the situation is different with other versions).
Using http: or https: links intercepted by an app
In theory, just using the https://docs.google.com/... link for the document should work for you. According to this answer on StackOverflow, intercepting http: or https: URLs is the proper way to start an app when opening a link from the Android browser. The Google Drive app does exactly this — it registers intent filters for https://drive.google.com, https://docs.google.com, https://spreadsheets.google.com and a bunch of similar URLs (including http: with the same host names). And this actually works — when using the stock Android browser, attempting to open a link pointing to https://drive.google.com results in the chooser popup with the Google Drive app included in the list (together with all installed browsers); selecting Google Drive results in opening the document in the Google Drive editor, as you want.
But the problem is that such intercepted HTTP[S] URLs work only in the stock Android browser — I have not been able to find any third-party browser which could show the app chooser when following such links. I tested Chrome, Dolphin, Firefox, Light Browser, Opera (including Classic and Mini), UC Browser, and all of them just opened the link internally instead of offering to pass it to the Google Drive app.
Using the intent: URI scheme
There is another way to make a link which starts an Android app — use the intent: URI scheme. I have not been able to find proper documentation for the intent: URI format; of course, the source code for the function which generates such URIs is available.
For your test document:
https://docs.google.com/document/d/1zSzDnV-90Ke3dzCCJ2CZ6iQ3JQ3F1hL1udGDqbNwwbY/edit?usp=sharing
the corresponding intent: link which opens it in the Google Drive app will be:
intent://docs.google.com/document/d/1zSzDnV-90Ke3dzCCJ2CZ6iQ3JQ3F1hL1udGDqbNwwbY/edit?usp=sharing#Intent;scheme=https;action=android.intent.action.VIEW;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;package=com.google.android.apps.docs;end
A test link with this URI is on a separate page (it is not possible to make an actual link pointing to such URI here).
The process of conversion is as follows:
Replace starting https: with intent:.
Append intent parameters:
#Intent;scheme=https;action=android.intent.action.VIEW;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;package=com.google.android.apps.docs;end
Here scheme=https correspond to https: in the original URL, so if you want to convert a plainhttp: URL, this field should be scheme=http. And package=com.google.android.apps.docs is the package name of the app which should handle the link.
Now, when such link is followed, the browser should open the Google Drive app directly (without showing the app chooser). However, if the app is not installed, Android will open the Market app instead, and perform a search for the specified package name, so that the user could install the required app.
It is also possible to make the intent: link without the package parameter:
intent://docs.google.com/document/d/1zSzDnV-90Ke3dzCCJ2CZ6iQ3JQ3F1hL1udGDqbNwwbY/edit?usp=sharing#Intent;scheme=https;action=android.intent.action.VIEW;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;end
In this case the behavior should be the same as when the intercepted https: link is followed in the stock Android browser — the app chooser with the Google Drive app and all browser apps will be displayed, and if the Google Drive app is not installed, the user will not be redirected to install it from Market.
Unlike intercepted http: and https: links, intent: links work in a wider range of Android browser apps; unfortunately, some browsers do not support them. Results of my testing:
Works: stock Android 4.0.4 browser, Chrome, Light Browser, Opera, Opera Classic.
Does not work: Dolphin, Firefox (feature request is pending), UC Browser.
And, obviously, non-Android browsers would not support such links at all, so you will need to use some kind of browser sniffing if your pages also must be usable for other clients.
Using a custom URI scheme
Some apps use completely nonstandard URI schemes, which might also work from third-party browsers. However, the Google Drive app does not do that, therefore this solution is not suitable for it (unless someone creates a “bridge” app which just passes requests to the Google Drive app).
Some browsers could also disallow nonstandard URI schemes except some whitelisted ones (such as market:) due to security concerns; I did not try to test this.