Encountering an issue with Selenium JS
Components are created in JSON format as follows:
"usernameInputField": {
"selector": {
"xpath": "//*[@id='username']"
}
}
For invoking webdriver, the following is used:
var webdriver = require('selenium-webdriver');
When trying to access data like this:
console.log(webdriver.By.xpath("//*[@id='username']"));
The above call works correctly.
However, when attempting
console.log(webdriver.By(usernameInputField.selector));
An error is encountered (
TypeError: Class constructors cannot be invoked without 'new'
)
What might be causing this issue?