1
votes

I have created a new profile for Firefox to be used with Robot Framework SeleniumLibrary. However the profile is not loaded using the following

*** Settings ***
Library    SeleniumLibrary

*** Keywords ***
Just testing
    Open Browser    about:blank    Firefox    ff_profile_dir=C:${/}Users${/}Administrator${/}AppData${/}Roaming${/}Mozilla${/}Firefox${/}Profiles${/}dev

*** Test Cases ***
Just testing

Which profile is used can be seen from page about:profiles

However, when checking about:profiles on a browser launched by webdriver, the profile is not marked as in use: page about:profiles on a browser launched by Webdriver

Any thoughts why Firefox profile is not loaded? EDIT: How do I know for sure if the profile is loaded or not?

Looking at geckodriver log the directory seems to be totally different

mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\rust_mozprofile2iM6KC"

The reason I have created separate profile is to bypass NTLM authentication using AutoAuth extension when launching automated tests suite.

SeleniumLibrary 4.0.0 Robot Framework 3.1.2 (Python 3.7.4 on win32) Firefox 69.0.3

1

1 Answers

0
votes

I've looked at my custom keyword to setup firefox profile:

from robot.api import logger
from selenium.webdriver import FirefoxProfile

class SeleniumPyExtension:

    @staticmethod
    def setup_firefox_profile(download_dir):
        profile = FirefoxProfile()
        logger.info('Download dir is {}'.format(download_dir))
        profile.set_preference("browser.download.dir", download_dir)
        profile.set_preference("browser.download.folderList", 2)
        profile.set_preference(
            'browser.helperApps.neverAsk.saveToDisk',
            'image/jpeg;'\
            'application/vnd.ms-excel;'\
            'application/octet-stream;'\
            'application/pdf;'\
            'application/ogg;'\
            'audio/mpeg;'
        )
        profile.set_preference("pdfjs.disabled", True)
        profile.update_preferences()
        profile_dir = profile.profile_dir
        logger.info('Profile is located at {}'.format(profile_dir))
        return profile_dir

and checked what it creates and it occurred that it creates directory with only user.js with bunch of user_pref(...) as described here.