首页 文章

Selenium无法找到firefox路径 - selenium-webdriver

提问于
浏览
1

我有用ruby编写的自动化框架 . 我得到无法找到Firefox二进制文件(os = windows) . 确保安装Firefox或使用Selenium手动设置路径:: WebDriver :: Firefox :: Binary.path =(Selenium :: WebDriver :: Error :: WebDriverError)

当然我已经安装了firefox . 我尝试重新安装firefox和ruby,以及selenium-webdriver gem,我收到此错误消息 . 我不能在我的测试中硬化路径,它必须全局设置 . 我尝试更改selenium-webdriver .rb文件,但没有任何帮助 .

1 回答

  • 1

    我建议使用Selenium设置一个GridHub,使用类似这样的配置:

    {
        "capabilities":
        [
            {
                "browserName": "firefox",
                "acceptSslCerts": true,
                "javascriptEnabled": true,
                "takesScreenshot": false,
                "firefox_profile": "",
                "firefox_binary": "C:\Program Files (x86)\Mozilla Firefox\firefox.exe",
                "browser-version": "35.0.1",  
                "platform": "WINDOWS",                     
                "maxInstances": 5
            },
            {
                "browserName": "chrome",
                "maxInstances": 5,
                "platform": "WINDOWS"
            },
            {
                "browserName": "internetExplorer",
                "maxInstances": 1,
                "platform": "WINDOWS"
            }
        ],
        "configuration":
        {
            "_comment" : "This is configuration for the grid node 1.",
            "cleanUpCycle": 2000,
            "timeout": 30000,
            "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
            "port": 5555,
            "host": ip,
            "register": true,
            "hubPort": 4444,
            "maxSessions": 5
        }
    }
    

    一旦启动并运行,请转到以下URL:

    http://127.1:4444/grid/console
    

相关问题