我是机器人框架的新手,我尝试通过机器人框架设置Firefox二进制的路径而没有成功。我的目标是解析以下Python代码:
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('c:pathtobinary')
driver = webdriver.Firefox(firefox_binary=binary)
使用机器人框架:
${firefox_path}= Evaluate sys.modules['selenium.webdriver'].firefox.firefox_binary.FirefoxBinary(firefox_path="C:\Users\xxx\ff\firefox.exe", log_file=None) sys
Create WebDriver Firefox firefox_binary=${firefox_path}
Go to www.google.fr
但是,当我运行上述时,我会收到以下错误消息:
WebDriverException: Message: Expected browser binary location, but unable to
find binary in default location, no 'moz:firefoxOptions.binary' capability
provided, and no binary flag set on the command line
有人知道如何解决我的问题吗?任何帮助将不胜感激,两天的尝试使Firefox上班。
谢谢,Nelly
我与您分享一个解决方案:
如果要测试Firefox扩展支持版本或便携式Firefox,则只需将木偶设置为False
${firefox_path}= | Evaluate | sys.modules['selenium.webdriver'].firefox.firefox_binary.FirefoxBinary(firefox_path='C:\Users\xxx\FirefoxPortable37\FirefoxPortable.exe', log_file=None) | sys
${caps}= | Evaluate | sys.modules['selenium.webdriver'].common.desired_capabilities.DesiredCapabilities.FIREFOX | sys
Set To Dictionary | ${caps} | marionette=${False}
Create WebDriver | Firefox | firefox_binary=${firefox_path} | capabilities=${caps}
Go To | http://free.fr