Page 1 of 1

Firefox Home Page

Published: Dec 23, 2019 - 2:23 PM
by Smart
WAPT 1.7.4 - CentOS 7 Server - Windows Server 2016
------------------------------------------------------------------------------------------
Good morning,
I'm trying to change the Firefox homepage using a script. It runs perfectly on local machines, but not via WAPT.

Code: Select all

     import getpass
     import os
    #ferme Firefox
    killalltasks('firefox')

    #Recupere l'utilisateur actif
    username = getpass.getuser()
    print(username)

    #chemin du profil firefox
    fhp = "C:\\Users\\" + os.environ["username"] + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles"

    profil = os.listdir(fhp)
    x = profil[0]

    mod = "C:\\Users\\" + os.environ["username"] + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\" + x
    print (mod)
    os.chdir(mod)

    #insertion de **** comme HomePage, Google comme moteur de recherche, desactivation mise à jour auto
    pref = open("prefs.js","w")
    pref.write('user_pref("browser.startup.homepage", "https://****");')
    pref.write('user_pref("browser.search.defaultenginename", "Google");')
    pref.write('user_pref("app.update.auto", false);')
    pref.close()

    print('L\'installation c\'est terminee. Ouvrez et fermez Firefox pour appliquer les changements.')
I'm getting the following error on WAPT (it's using the computer name and not the username):

Code: Select all

WindowsError: [Error 3] Le chemin dÆaccÞs spÚcifiÚ est introuvable: 'C:\\Users\\PL177$\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*.*'
3 : Le chemin dÆaccÞs spÚcifiÚ est introuvable

Re: Firefox Home Page

Published: January 2, 2020 - 10:12 AM
by sfonteneau
Look here:

https://www.wapt.fr/fr/doc/wapt-create- ... index.html

Wapt is launched as the system account, so when you type os.environ["username"] you will get the computer name.

Alternatively, with Firefox you can use this: https://support.mozilla.org/fr/kb/perso ... icies-json