-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Load a setting file from an external script #301
Comments
Hi @dpellegr, I'll be writing a detailed guide for developers about this use case because I think it's pretty useful for certain purposes and there's a few people who have asked something similar in the past. I figure you're probably most interested in switching between browser profiles and any other additional settings would stay consistent? I've been down this route and it works pretty well. In fact, this is somewhat how Chameleon is tested! You can find some examples of NodeJS/Selenium here. Here's a short TLDR of how it works:
Using JS/preferred browser automation library, you should now be able to interact with the popup page. This is the page shown when you click the Chameleon icon. To load settings go to |
Hi, sorry for the late reply. This is indeed pretty helpful! Thank you! |
Hi @sereneblue, I have spent a couple of days trying to find a way to interact with a At this point I think that the best course of actions would be to plant a If you agree, I am happy to follow this up aiming at producing a pull request. Thank you! |
Don't worry, I've got you covered. ;) I wrote a Python script that gets you to the the Chameleon popup page and selects the
I tested with Python 3.8, FF Dev 75 and FF74, and Selenium 3.141. Please let me know if you're still experiencing issues. |
@sereneblue Thank you! Yep, that worked perfectly. However Selenium is a huge and noisy weapon. One of the requirements of my project is avoiding it. I think that I will look anyway into a small chameleon driver listening on javascript. I'll let you know if it turns out nicely. |
@dpellegr What library/tool are you using? |
For learning/fun I wrote my own browser extension which:
As the socket is language agnostic, this allow any program to communicate with the internals of the browser in a transparent and pretty stealth way. Anyway, I have been looking in the chameleon source code (v0.20 yay!!) and so far with about 10 lines, I managed send messages to the BTW should I test on the alpha2 release or on the develop branch? |
Interesting, I've explored doing something similar for the You should check out the You should test on the develop branch. It usually will contain some fixes/features that aren't in the latest dev build. |
Everything looks great from here! These are the edits that I introduced: Then in my
Clearly one needs to know how to shape the requests, but for just importing the settings (as I originally desired) that is pretty straightforward. |
@dpellegr Glad to see you've got everything sorted out. |
Do you think that you could consider pulling my additions to An important step in this direction could be adding a GUI entry to set the |
Sure, I'll consider it. I'll be writing a developer guide soon so I'm happy to take a look to see if this is something that can also be added to Chameleon. Personally, I'd prefer developers control Chameleon using the popup page since it provides consistency across libraries like Selenium/Puppeteer/etc. This seems to be an interesting use case though. I don't mind adding it to the dev builds of Chameleon but I'll have to get a bit familiar with the workflow first. |
Great! Selenium is an excellent tool but many websites frown upon it. This method instead is pretty much undetectable in addition to being more slender and direct. |
Thanks. Once I'm done with the developer's guide, feel free to check it out and if there's any improvements that can be made, feel free to submit a pull request. The wiki is located in a branch here. Selenium is convenient because there's usually a library in every language you'd want to use, but I'd reach for Puppeteer/Playwright instead.They're very good alternatives that avoid the issues brought with Selenium. You may find this blog post useful. |
@dpellegr I've added some code that should allow the dev build to be controlled by another extension here. Please let me know if there are any issues. I've also updated the developer guide. |
Wonderful! It looks perfectly integrated. The only issue that I see is that no confirmation is sent back, indeed on my side I wait for that to proceed. This: chameleon/src/lib/chameleon.ts Line 811 in 6a61610
should probably become: browser.runtime.sendMessage(request, null, port.postMessage);
Then here: Line 24 in 6a61610
You should make sure that all the actions that could be sent by another extension (or at least the ones exemplified in the wiki) invoke the callback, even if in a silly way such as |
@dpellegr Thanks! I've updated the above functions based on your suggestions. |
Hi sereneblue, Do you think that a dev build is suitable for being published on https://addons.mozilla.org ? Thank you in advance for letting me know! |
Great, thank you!
…On Fri, May 8, 2020, 00:05 sereneblue ***@***.***> wrote:
Hi @dpellegr <https://github.com/dpellegr>,
The dev builds on the releases
<https://github.com/sereneblue/chameleon/releases> page are signed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#301 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3UFLXQEYXXMS6N6U3R6C3RQMWA7ANCNFSM4LNKCRRQ>
.
|
Sorry to bother you again, but I have started to migrate from my custom build and unfortunately we are not there yer :( This line seems wrong: chameleon/src/lib/chameleon.ts Line 844 in 3be8d6e
as calling sendMessage directly (without a message handler) the arguments get completely different meanings: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/sendMessage This should be the necessary fix (without the console.log line): master...dpellegr:master However even with the fix in place, on |
@dpellegr I've updated the dev build with your change. I'll do some testing on my own to see if I can get a connection to Chameleon from an extension. |
I am observing additional instabilities in the latest releases (I tried 20.3 and 20.4), like the pop-up sometimes disappearing when browsing it. In the console I get messages like:
It is really hard to track it down to a specific sequence of actions, but I believe that this could be related to my communication issue. Also, with previous v20 releases, I remember having few icons reporting the status of the protection at the bottom of the popup home page. Now I do not see them any longer. |
@dpellegr The fingerprint detection panel has been removed from Chameleon. It caused a number of issues with sites. I was able to send a message to Chameleon using the following background script:
I've rewritten the external listener in 3db7049. Instead of using ports, it's much easier to use |
Check these out: https://github.com/dpellegr/RedBlue They are two super simple extensions which I temporary load from When clicking on their icons, Blue sends a message to Red (which receives it properly), in the same way Red sends a message to Chameleon v0.20.5 which for me keeps failing.
Actually it seems to me that the message gets sent properly, but Chameleon internally fails to handle it. |
@dpellegr Chameleon is actually handling the message. You can verify this by checking the response.
Changes to settings need to be saved if you want the UI to be updated or for settings to be persistent.
|
You were right. Everything seems fine from here. |
Hi,
I would like to load a setting file from an application external to the browser (eg a python script) which manages a directory of them. What would be the easiest way to accomplish this?
Many thanks!
The text was updated successfully, but these errors were encountered: