teamcfadvance / CFSelenium

A native Selenium WebDriver binding for ColdFusion
Apache License 2.0
81 stars 32 forks source link

Problem with example on README #35

Closed dezoito closed 2 years ago

dezoito commented 5 years ago

After upgrading to the latest version, I am having trouble getting tests to run by following the example posted on the README file (I am using Testbox):

component extends="testbox.system.BaseSpec"{
    this.javaSettings = { loadPaths = [ '/cfselenium/lib/selenium-server-standalone-3.4.0.jar' ] };

    // executes before all suites
    function beforeAll(){
        selenium = new cfselenium.SeleniumWebDriver( driverType="firefox");
        driver = selenium.getDriver();
        driver.get( "https://www.google.com" );
        writedump( var="#driver.getTitle()#" ); // evaluates to "Google"
    }

    // executes after all suites
    function afterAll(){
        driver.quit();
    }
}

This generates the following error:

`The parameter webdriver to function init is required but was not passed in.`

If I do specify the webdriver, however, I get another error:

component extends="testbox.system.BaseSpec"{
    this.javaSettings = { loadPaths = [ '/cfselenium/lib/selenium-server-standalone-3.4.0.jar' ] };

    // executes before all suites
    function beforeAll(){
        selenium = new cfselenium.SeleniumWebDriver( driverType="firefox", webdriver="FirefoxDriver");
        driver = selenium.getDriver();
        driver.get( "https://www.google.com" );
        writedump( var="#driver.getTitle()#" ); // evaluates to "Google"
    }

    // executes after all suites
    function afterAll(){
        driver.quit();
    }

Error:

cannot load class through its string name, because no definition for the class with the specified name [org.openqa.selenium.firefox.FirefoxDriver] could be found caused by (java.lang.ClassNotFoundException:org.openqa.selenium.firefox.FirefoxDriver;java.lang.ClassNotFoundException:org.openqa.selenium.firefox.FirefoxDriver not found by lucee.core [46];)

A similar error occurs if I try "WebDriver" instead of "FireFoxDriver".

I have also used relative and full paths in the line below with the same results:

this.javaSettings = { loadPaths = [ '/cfselenium/lib/selenium-server-standalone-3.4.0.jar' ] };

Any insight on what I am missing?