李恒道 发表于 2022-9-20 21:03:08

nodejs解决seleniutm启动错误

IEDriverServer.exe could not be found on the current PATH. Please download the latest version of IEDriverServe balabal
因为我路径写错了
C:\Users\god\IEDriverServer.exe
不小心写成了C:\Users\god\IEDriverServer
不能携带文件名
然后提示
protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones
参考
https://blog.csdn.net/huyanyan08/article/details/78459641
关闭ie安全模式
打开IE——》设置——》Internet选项——》安全——》去掉启用保护模式前的对勾
![图片.png](data/attachment/forum/202209/20/205905on449rqbbta01zli.png)
# 注意
![图片.png](data/attachment/forum/202209/20/210040kyljoj5xjp5ego3t.png)
这里有四个要全关
推荐安全级别也拉到最低,受限制的不用

然后跑一个最基本的例子
```javascript
const { Builder, By, Key, until} = require("selenium-webdriver");

(async function example() {
let driver = await new Builder().forBrowser('internet explorer').build(); // 以firefox浏览器为目标构建器
try {
    await driver.get('http://www.baidu.com');
} finally {
    await driver.quit();
}
})();

```
运行成功
![图片.png](data/attachment/forum/202209/20/210303fr8nrxmrvzxx0dr9.png)
# 结语
撒花~
页: [1]
查看完整版本: nodejs解决seleniutm启动错误