selenium 运行多个 ie 实例有什么好方法么

2019-08-21 09:59:22 +08:00
 asus10tu
最近公司需求要实时操作一个网站,但是年代太旧只能 ie 打开。

但是 iedriver 官方说多个实例会导致操作失败,推荐用虚拟机之类,但是手头仅有一台机子,多个虚拟机会不会太重了,有什么更好的思路么,或者非常轻便仅仅跑浏览器足以的虚拟机,谢谢了。
1965 次点击
所在节点    Python
9 条回复
ppokyou
2019-08-21 10:05:45 +08:00
没看懂,多个 ie 实例跟多个虚拟机有什么关系?
jackielu
2019-08-21 10:07:09 +08:00
尝试一下 pyppeteer
otakustay
2019-08-21 10:11:28 +08:00
@jackielu 人家要 IE 你让人家用 puppeteer,啥逻辑……
imyip
2019-08-21 10:14:59 +08:00
本来想说 docker, 然后才看到了是 ie
asus10tu
2019-08-21 10:19:40 +08:00
@ppokyou 多个实例是打算开几个 ie 同时操作网页,但是这样会互相影响出问题,导致找不到元素,点不到之类,官方建议是开多个虚拟机,然后每个虚拟机运行一个 ie。
Vegetable
2019-08-21 10:23:35 +08:00
特意去看了一下,你验证过这个问题吗?
https://raw.githubusercontent.com/SeleniumHQ/selenium/master/cpp/iedriverserver/CHANGELOG

v3.141.5.8
Please note that the advice and support policy of the IE driver will
continue to be that the user must set the Protected Mode settings of
the browser properly before using the driver. Any "issues" that arise
by not having the settings set, but that disappear when the settings
are corrected, are not considered by the project to be valid issues.
This will include, but not be limited to, issues like abandoned
browser instances not being closed, use of multiple instances of the
driver where the wrong browser window is connected to and automated,
and issues where the driver appears to hang upon navigation to a new
page. If the problem disappears when the browser is properly
configured, any issue reports will be immediately closed with a note
to properly configure the browser and remove the capability.

v2.26.0.6
=========
* Added use of a mutex when creating a session. This should allow multiple
threads to create and use different instances of IEDriverServer.exe,
enabling multiple instances under most language bindings.

我不能试,但是看这个更新日志,多个实例出错好像是因为没打开 Protected Mode?
asus10tu
2019-08-21 10:58:26 +08:00
@Vegetable 保护模式的话,一开始 ie 有警告,所以已经全部打开了,还是如此。
asus10tu
2019-08-21 15:40:16 +08:00
有大佬给点点思路么,我已经想不到其他方法了
ppokyou
2019-08-23 13:25:14 +08:00
@asus10tu 可以试试以下两种思路:
1. 在同一台测试机上启动多个实例,但确保每个实例都是不同的 windows user,这样就可以隔离
2. 测试机上装个 windows docker desktop,在不同的 container 里跑

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/593726

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX