未经手的反射措施:NosuchsessionError:尝试运行命令而不建立连接
我试图将selenium-webdriver
与nodejs
一起使用。每件事都变得顺利,但是一旦结束,它就会在终端中出现此错误。这是什么问题。
无用的征服者:NosuchsessionError:试图运行 命令而不建立连接。
这是我的代码,
let webdriver = require('selenium-webdriver');
const { Builder, Key, until } = require('selenium-webdriver');
By = webdriver.By;
let driver = new webdriver.Builder().forBrowser('firefox').build();
driver.get('https://www.google.com/');
pause(2, ScraperExample);
function ScraperExample() {
console.log('Scrapping the Pagee...');
pause(3, QuitDriver);
}
function pause(Time, FuncName) {
setTimeout(FuncName, Time * 1000);
}
function QuitDriver() {
driver.close();
driver.quit();
console.log('The Driver is set to off...');
}
I was trying to use selenium-webdriver
with nodeJs
. Every thing was going smooth but as soon as it end it pop up with this error in terminal.What's wrong in this.
UnhandledPromiseRejectionWarning: NoSuchSessionError: Tried to run
command without establishing a connection.
Here is my code,
let webdriver = require('selenium-webdriver');
const { Builder, Key, until } = require('selenium-webdriver');
By = webdriver.By;
let driver = new webdriver.Builder().forBrowser('firefox').build();
driver.get('https://www.google.com/');
pause(2, ScraperExample);
function ScraperExample() {
console.log('Scrapping the Pagee...');
pause(3, QuitDriver);
}
function pause(Time, FuncName) {
setTimeout(FuncName, Time * 1000);
}
function QuitDriver() {
driver.close();
driver.quit();
console.log('The Driver is set to off...');
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了我自己问题的解决方案之一,我们可以使用此
drive.close()
或driver.quit()
来解决它。被使用比我们将面临的问题。I found one of the solution for my own question, we can resolve it by using any one of this
drive.close()
ordriver.quit()
if both of going to be used than we will face issues.