[英]Watir - Load Firefox default profile - Permission denied
I'm using Watir in a Ruby script to automatically download some files and I have a little problem : 我在Ruby脚本中使用Watir来自动下载一些文件,但是我有一个小问题:
If Firefox is already running, I get a "permission denied" error when I try to load firefox default profile. 如果Firefox已经在运行,则在尝试加载Firefox默认配置文件时出现“权限被拒绝”错误。 I know it's quite normal... But I really need my firefox default profile. 我知道这很正常……但是我确实需要我的firefox默认配置文件。
So my question is : 所以我的问题是:
Something like above : 像上面的东西:
Mozilla = Watir::Browser.new(:firefox, :profile => "default")
file = File.open("path", 'w')
file.write(Mozilla.export_profile())
and then in another script : 然后在另一个脚本中:
profile = Selenium::WebDriver::Firefox::Profile.new(File.read("path"))
Mozilla = Watir::Browser.new(:firefox, :profile => profile)
Or I have to export (and then load) each property one by one ? 还是我必须逐一导出(然后加载)每个属性?
the behaviour you are seeing is normal and correct. 您看到的行为是正常且正确的。
The are two way to work around his: 解决他的两种方法:
The choice depends on what you need. 选择取决于您的需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.