selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Set firefox profile from pre-existing browser profile or set extension protractor

Open tamvo94 opened this issue 9 years ago • 20 comments

I have 2 ways set firefox profile:

var makeFirefoxProfile = function (preferenceMap) { var profile = new firefox.Profile("./ozbzfc4i.automation"); for (var key in preferenceMap) { profile.setPreference(key, preferenceMap[key]); }

return q.resolve({ browserName: 'firefox', marionette: true, firefox_profile: profile }); };

and code load web extension:

var makeFirefoxProfile = function (preferenceMap) { var profile = new firefox.Profile(); for (var key in preferenceMap) { profile.setPreference(key, preferenceMap[key]); } profile.addExtension('./firebug.xpi');

return q.resolve({ browserName: 'firefox', marionette: true, firefox_profile: profile }); }; But it cannot set profile and browser opens multiple tabs when run, not single tab. I follow this article: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index.html I don't know how wrong???

tamvo94 avatar Feb 13 '17 16:02 tamvo94

What do you mean it opens multiple tabs not single tab? From your issue here (https://github.com/saadtazi/firefox-profile-js/issues/82) you were using firefox-profile-js before, since you no longer use it you don't get the default firefox preferences from it (https://github.com/saadtazi/firefox-profile-js/blob/master/lib/firefox_profile.js#L25)

If you want it to open multiple windows instead of multiple tabs you need to set this https://github.com/saadtazi/firefox-profile-js/blob/master/lib/firefox_profile.js#L32. Default for geckodriver is 3 which opens external links in new tabs

lmtierney avatar Feb 13 '17 20:02 lmtierney

Hi lmtierney, I'm using require('selenium-webdriver/firefox').Profile;, not firefox-profile package. The problem here is filefox cannot load profile from pre-existing browser profile. If I declare var profile = new firefox.Profile(); it works ok. If I declare var profile = new firefox.Profile("./ozbzfc4i.automation"); I could not find profile ozbzfc4i.automation loaded. I want to set firefox profile from pre-existing browser profile with param ./ozbzfc4i.automation Thanks

tamvo94 avatar Feb 14 '17 01:02 tamvo94

I understand what you're doing. How do you know it isn't using the profile?

lmtierney avatar Feb 14 '17 01:02 lmtierney

I installed extension, edit config, whatever,... when protractor load firefox profile ./ozbzfc4i.automation, I want to see things I did earlier are shown, example: extensions I install are loaded Thanks :)

tamvo94 avatar Feb 14 '17 01:02 tamvo94

Is it giving you an error? What do you see if you put a breakpoint in and check the about:config page within Firefox, do you see your preferences as you set them?

lmtierney avatar Feb 14 '17 01:02 lmtierney

It is still running normally, no error, but I cannot see extension I installed and path download file I set earlier. When I add profile.addExtension('./firebug.xpi'); not use pre-existing browser profile, It also show the same case. Thanks

tamvo94 avatar Feb 14 '17 01:02 tamvo94

Are you sure it's not loaded? I just tried it with firebug and it's loaded but is disabled.

lmtierney avatar Feb 14 '17 02:02 lmtierney

Make sure you use the root directory of the profile you pass it and not the local directory

lmtierney avatar Feb 14 '17 02:02 lmtierney

Hi, can you help me reprodurce at my repo in 2 ways. I want to try set firefox profile from pre-existing browser profile because load extension is disabled. Thanks.

tamvo94 avatar Feb 14 '17 02:02 tamvo94

Attach image: http://www.upsieutoc.com/image/YcERRQ

tamvo94 avatar Feb 14 '17 02:02 tamvo94

Hi lmtierney, What is the root directory of the profile???

C:\Users\...\AppData\Roaming\Mozilla\Firefox\Profiles\avbq6r8s.TamVo or C:\Windows, or whatever folder contains profile,.... Thanks

tamvo94 avatar Feb 14 '17 06:02 tamvo94

Go to about:profiles in the browser and copy the path for the Root Directory

lmtierney avatar Feb 26 '17 03:02 lmtierney

Hi lmtierney, I set profile var firefoxProfile = new FirefoxProfile("C:/Users/.../AppData/Roaming/Mozilla/Firefox/Profiles/avbq6r8s.TamVo"); But i have an error:

 WebDriverError: java.io.FileNotFoundException: C:\Users\...\AppData\Local\Temp\webdriver3207885029359577597duplicated\C:\Users\...\AppData\Local\Temp\tmp-12720YNCuK
ZQFwPPR\addons.json (The filename, directory name, or volume label syntax is incorrect)

When I add directConnect: true it run ok, but not set profile. The problem in here is directConnect cannot set firefox profile? Thanks.

tamvo94 avatar Feb 28 '17 02:02 tamvo94

FirefoxProfile("C:/Users/.../AppData/Roaming/Mozilla/Firefox/Profiles/avbq6r8s.T") does not match your C:\Users\...\AppData\Roaming\Mozilla\Firefox\Profiles\avbq6r8s.TamVo that you said earlier

lmtierney avatar Feb 28 '17 04:02 lmtierney

Sorry, I edited last comment FirefoxProfile("C:/Users/.../AppData/Roaming/Mozilla/Firefox/Profiles/avbq6r8s.TamVo"), but issue still occur

tamvo94 avatar Feb 28 '17 04:02 tamvo94

Attach root directory image: http://www.upsieutoc.com/image/Y2emkL

tamvo94 avatar Feb 28 '17 04:02 tamvo94

Error image: http://www.upsieutoc.com/image/Y2PfOq

tamvo94 avatar Feb 28 '17 04:02 tamvo94

We need a way to reproduce this issue without protractor, using pure official selenium client library.

barancev avatar Aug 04 '17 14:08 barancev

It sounds like you are expecting webdriver changes to impact the preexisting profile. This is not the case - when you specify an existing profile it is copied to a new profile, so any changes made with webdriver will not impact the original. On Fri, Aug 4, 2017 at 7:38 AM Alexei Barantsev [email protected] wrote:

We need a way to reproduce this issue without protractor, using pure official selenium client library.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/3500#issuecomment-320266177, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPkCcE9KgGwJPF0NXAfqe1LNDsekj15ks5sUyz5gaJpZM4L_ZdH .

jleyba avatar Aug 05 '17 21:08 jleyba

Closing the issue, there is no reporoduction scenario provided.

barancev avatar Aug 31 '17 20:08 barancev