Selenium Python Firefox webdriver : can't modify profile -


i want use, on webdriver firefox instance, "new tab instead of window" option. 1/ created profile option on, when use profile lot of options ok not one. 2/ after load of profile tried change option in code n't work. code :

profile = webdriver.firefoxprofile(os.path.join(s_path, name)) profile.set_preference("browser.link.open_newwindow.restriction", 0) profile.set_preference("browser.link.open_newwindow", 3) profile.set_preference("browser.link.open_external", 3) profile.set_preference("browser.startup.homepage","http://www.google.fr") profile.update_preferences() print(os.path.join(s_path, name)) driver = webdriver.firefox(set_profile()) 

all ok (the start homepage google.fr) except option not ok.

it seems selenium copy profile in temp dir. users.js have wrong line :

user_pref("browser.link.open_newwindow", 2); 

python 3.4.2, windows 7, firefox 39.0, selenium lib 2.46

from i've researched, browser.link.open_newwindow frozen setting , it's synced value 2. if dig source of selenium python bindings, find set of frozen settings applied after custom settings set.

note in java bindings set of default frozen settings explicitly hardcoded:

  /**    * profile preferences essential firefoxdriver operating correctly. users not    * permitted override these values.    */   private static final immutablemap<string, object> frozen_preferences =       immutablemap.<string, object>builder()           .put("app.update.auto", false)           .put("app.update.enabled", false)           .put("browser.download.manager.showwhenstarting", false)           .put("browser.eula.override", true)           .put("browser.eula.3.accepted", true)           .put("browser.link.open_external", 2)           .put("browser.link.open_newwindow", 2)  // here           // ... 

and bit of explanation coming firefox supports windows not tabs:

this known issue , unfortunately not supporting tabs.

we force firefox open links in new window. can't access tabs know when switch. when move marionette (mozilla project) in future should able working intended

a workaround solution change target of link manually - may not work in of cases depending on how new link opened.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -