Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98798

Selenium Webdriver: extending Navigation causes circular dependency issue

$
0
0

I have a very simple app.ts file that looks like this:

import { Navigation, WebDriver } from "selenium-webdriver";

class MyWebDriver extends WebDriver {
    navigate(): Navigation {
        return new MyNavigation(this);
    }
}

class MyNavigation extends Navigation {
    constructor(driver: WebDriver) {
        super(driver);
    }
}

I have also installed the NPM package selenium-webdriver@4.0.0-alpha5 and I'm using NodeJS version 10.15.3.

Now when I build the project and run the app.js file on the command line, I get the following circular dependency exception:

C:\temp\MyTestNodejsProject>node app.js
C:\temp\MyTestNodejsProject\app.js:9
class MyNavigation extends selenium_webdriver_1.Navigation {
                                                ^
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\temp\MyTestNodejsProject\app.js:9:49)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

The above circular dependency exception is complaining about line 9 of the app.js file below:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const selenium_webdriver_1 = require("selenium-webdriver");
class MyWebDriver extends selenium_webdriver_1.WebDriver {
    navigate() {
        return new MyNavigation(this);
    }
}
class MyNavigation extends selenium_webdriver_1.Navigation {
    constructor(driver) {
        super(driver);
    }
}
//# sourceMappingURL=app.js.map

Can someone please help me figure out how to fix this circular dependency? I've spent days on this and don't see where the circular dependency is happening. Please provide a working code snippet.


Viewing all articles
Browse latest Browse all 98798

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>