Firefox配置文件未加载到Robot Framework SeleniumLibrary 4.0的开放浏览器中
我已经为Firefox创建了一个新的配置文件,用于Robot框架SeleniumLibrary。但是,不使用以下命令加载配置文件Firefox配置文件未加载到Robot Framework SeleniumLibrary 4.0的开放浏览器中,firefox,selenium-webdriver,robotframework,firefox-profile,Firefox,Selenium Webdriver,Robotframework,Firefox Profile,我已经为Firefox创建了一个新的配置文件,用于Robot框架SeleniumLibrary。但是,不使用以下命令加载配置文件 *** Settings *** Library SeleniumLibrary *** Keywords *** Just testing Open Browser about:blank Firefox ff_profile_dir=C:${/}Users${/}Administrator${/}AppData${/}Roamin
*** 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
使用的配置文件可以从第页看到
但是,在webdriver启动的浏览器上检查关于:配置文件时,该配置文件未标记为正在使用:
有没有想过为什么没有加载Firefox配置文件?
编辑:如何确定配置文件是否已加载
查看geckodriver日志,目录似乎完全不同
mozrunner::runner INFO运行命令:“C:\\Program Files\\Mozilla Firefox\\Firefox.exe”“-marionette”“-前台”“-no remote”“-profile”“C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\rust\u mozprofile2iM6KC”
我创建单独概要文件的原因是在启动自动测试套件时使用AutoAuth扩展绕过NTLM身份验证
硒库4.0.0
Robot Framework 3.1.2(win32上的Python 3.7.4)
Firefox 69.0.3我查看了我的自定义关键字以设置Firefox配置文件:
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
并检查了它创建的内容,发现它只创建了一个目录,其中包含
user.js
和一堆user\u pref(…)
,如前所述。我已经查看了设置firefox配置文件的自定义关键字:
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
并检查了它创建的内容,发现它只创建了一个目录,其中包含user.js
和一堆user\u pref(…)
,如前所述