galenframework / galen

Layout and functional testing framework for websites
http://galenframework.com
1.41k stars 161 forks source link

Selenium WebDriver: AutomationException when instantiating page using $page #459

Open gameboyzone opened 7 years ago

gameboyzone commented 7 years ago

Hello,

I'm having issues instanciating the page using $page. When I use the following code, the page keeps on loading in the tab (the round loader keeps running). When I terminate that tab, I see the following exception in the console -

INFO: Detected dialect: OSS [176.657][SEVERE]: Unable to receive message from renderer org.mozilla.javascript.WrappedException: Wrapped org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from chrome not reachable (Session info: chrome=54.0.2840.99) (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace inform Command duration or timeout: 4.07 seconds Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'HH0082014935', ip: '168.40.110.147', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_111' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb Session ID: 925fc994503e392482619a108ff8fee8 (<cmd>#37) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at org.mozilla.javascript.gen._cmd__18._c_createDriver_2(<cmd>:37) at org.mozilla.javascript.gen._cmd__18.call(<cmd>) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) at org.mozilla.javascript.gen.C__Users_hshah01_Desktop_Docs_R99_GalenExample_haCalendar_test_js_20._c_anonymous_4(C:\Users\hshah01\Desktop\Docs\R99\GalenExample\haCalendar.tes at org.mozilla.javascript.gen.C__Users_hshah01_Desktop_Docs_R99_GalenExample_haCalendar_test_js_20.call(C:\Users\hshah01\Desktop\Docs\R99\GalenExample\haCalendar.test.js) at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2429) at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269) at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at org.mozilla.javascript.gen._cmd__17._c_invokeFunc_2(<cmd>:33) at org.mozilla.javascript.gen._cmd__17.call(<cmd>) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) at org.mozilla.javascript.gen._cmd__17._c_anonymous_22(<cmd>:280) at org.mozilla.javascript.gen._cmd__17.call(<cmd>) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090) at org.mozilla.javascript.gen._cmd__17.call(<cmd>) at org.mozilla.javascript.JavaAdapter.doCall(JavaAdapter.java:606) at org.mozilla.javascript.JavaAdapter.access$000(JavaAdapter.java:15) at org.mozilla.javascript.JavaAdapter$1.run(JavaAdapter.java:586) at org.mozilla.javascript.Context.call(Context.java:489) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504) at org.mozilla.javascript.JavaAdapter.callMethod(JavaAdapter.java:583) at adapter1.execute(<adapter>) at com.galenframework.TestRunnable.runTest(TestRunnable.java:75) at com.galenframework.TestRunnable.run(TestRunnable.java:101) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from chrome not reachable (Session info: chrome=54.0.2840.99) (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace inform Command duration or timeout: 4.07 seconds Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'HH0082014935', ip: '168.40.110.147', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_111' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb Session ID: 925fc994503e392482619a108ff8fee8 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635) at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.setSize(RemoteWebDriver.java:847) at com.galenframework.utils.GalenUtils.resizeDriver(GalenUtils.java:308) at com.galenframework.browser.SeleniumBrowser.changeWindowSize(SeleniumBrowser.java:55) at com.galenframework.utils.GalenUtils.createDriver(GalenUtils.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) ... 31 more

Command used to execute test in DOS galen test haCalendar.test.js --htmlreport reports -Dwebdriver.chrome.driver=C:\Users\user01\Desktop\Docs\R99\GalenExample\node_modules\chromedriver\bin\chromedriver.exe

Here's my code -

` this.devices = { mobile: { deviceName: "mobile", size: "400x700" }, tablet: { deviceName: "tablet", size: "600x800" }, desktop: { deviceName: "desktop", size: "1024x768" } };

this.createAccount = $page("YTB R98", { load: function () { this.open("http://sampleWebsite.com/Learn/CreateAccount"); return this.waitForIt(); }, runTests: function (userName, password) { console.log("Retrieved values: " + userName + " | " + password); console.log("DOM values: " + this.appointmentDate.attribute("placeholder")); this.appointmentDate.click(); } },{
}); forOnly(devices.desktop, function () { test("Your Texas Benefits on ${deviceName}", function (device){ // test code goes here var driver = createDriver("http://sampleWebsite.com/Learn/CreateAccount", device.size);

    var page = new createAccount(driver).load();
    page.runTests("testuser@example.com", "password");

    checkLayout({
        driver: driver,
        spec: "ytbCreateAccount.gspec",
        tags: ["desktop"],
        vars: {
            customVariable: "custom value"
        },
        objects: {
            header: "#header",
            footer: "xpath: //div[@id='footer']"
        }
    });

    driver.close();
});

}); `

gameboyzone commented 7 years ago

@ishubin