我使用perl和selenium/web驱动器编写用户界面测试。我知道我可以使用Selenium::Firefox::Profile
模块为Firefox创建配置文件。
我想使用我的默认配置文件或使用Firefox配置文件管理器创建的配置文件。是否可以使用现有的Firefox配置文件进行测试?
这不起作用:
my $ff_profile = Selenium::Firefox::Profile->new('default-1480098066829');
my $driver = Selenium::Remote::Driver->new(
'remote_server_addr' => 'localhost',
'browser_name' => 'firefox',
'firefox_profile' => $ff_profile,
'port' => '5555',
'marionette_enabled' => 1,
);
我的默认配置文件接受了必须测试的Intranet页面的自签名的SSL证书。当WebDriver打开带有新配置文件的页面时,由于Firefox证书对话框而失败。
如果我无法使用默认配置文件,是否有某种方法可以将此证书添加到WebDriver的新配置文件中?
我没有使用 Selenium::Firefox::Profile
的经验,但是查看 source ,它没有提供任何使用现有配置文件的设置的方法,但会始终使用Firefox的默认设置,并允许通过呼叫set_preference
和set_boolean_preference
清楚的是 new
构造函数只期望参数的哈希,而该哈希的唯一重要元素具有密钥 profile_dir
这意味着您的呼叫Selenium::Firefox::Profile->new('default-1480098066829')
将导致
哈希分配中元素的奇数
当您寻求帮助时,您应该报告的。如果您没有看到该消息,那么您就没有use warnings
,这将是您
您可以尝试Selenium::Firefox::Profile->new( profile_dir => '<my Firefox profile folder>' )
,但是如果这种变化很大,我会感到惊讶。默认情况下,模块使用File::Temp
创建一个新的临时文件夹,并将新的配置文件放入其中
您可能必须找到默认配置文件中缺少的选项的名称,并明确添加它们,除非有人比我更了解的人有一个更好的想法