Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Session Not found exception while running .js file #168

Closed
JigeshShah opened this issue Oct 21, 2016 · 0 comments
Closed

Session Not found exception while running .js file #168

JigeshShah opened this issue Oct 21, 2016 · 0 comments

Comments

@JigeshShah
Copy link

Hi All,

I am getting Session not found exception when I tried to run the below script using the command "node webCSS.js"

Steps that I followed

  1. Installed node.js and GraphicsMagick Display on the system

  2. Installed and started Selenium StandaloneServer using below commands
    npm install selenium-standalone@latest -g
    selenium-standalone install
    selenium-standalone start

  3. Installed webdriver io and webdriverCSS using below commands
    npm install webdriverio@2 webdrivercss

  4. After that I started ran the script WebCSS.js (script provided below)

Script
var assert = require('assert');

// init WebdriverIO
var client = require('webdriverio').remote({desiredCapabilities:{browserName: 'firefox'}})
// init WebdriverCSS
require('webdrivercss').init(client);

client
.init()
.url('https://www.google.com/')
.webdrivercss('startpage',[
{
name: 'header',
elem: '#header'
}, {
name: 'hero',
elem: '//*[@id="hero"]/div[2]'
}
], function(err, res) {
assert.ifError(err);
assert.ok(res.header[0].isWithinMisMatchTolerance);
assert.ok(res.hero[0].isWithinMisMatchTolerance);
})
.end();

Error that I am getting

17:00:52.533 INFO - Executing: [get: https://www.google.com/])
17:00:59.759 INFO - Done: [get: https://www.google.com/]
17:01:00.079 INFO - Executing: [delete session: 376fc292-6d51-4986-9bd0-56fa59877af9])
17:01:00.192 INFO - Executing: [execute script: return (function () {
/**
* remove scrollbars
*/
// reset height in case we're changing viewports
document.documentElement.style.height = 'auto';
document.documentElement.style.height = document.documentElement.scrollHeight + 'px';
document.documentElement.style.overflow = 'hidden';

            /**
             * scroll back to start scanning
             */
            window.scrollTo(0, 0);

            /**
             * get viewport width/height and total width/height
             */
            return {
                screenWidth: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
                screenHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
                documentWidth: document.documentElement.scrollWidth,
                documentHeight: document.documentElement.scrollHeight,
                devicePixelRatio: window.devicePixelRatio
            };
        }).apply(null, arguments), [null]])

17:01:01.441 INFO - Done: [delete session: 376fc292-6d51-4986-9bd0-56fa59877af9]
17:01:02.045 WARN - Exception thrown
org.openqa.selenium.remote.SessionNotFoundException: The FirefoxDriver cannot be used after quit() was called.
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:377)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:577)
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.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
at com.sun.proxy.$Proxy1.executeScript(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:217)
at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:54)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
17:01:02.201 WARN - Exception: The FirefoxDriver cannot be used after quit() was called.
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
Driver info: driver.version: EventFiringWebDriver

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants