V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
asus10tu
V2EX  ›  Python

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

  •  
  •   asus10tu · 2019-08-21 09:59:22 +08:00 · 1766 次点击
    这是一个创建于 1681 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近公司需求要实时操作一个网站,但是年代太旧只能 ie 打开。

    但是 iedriver 官方说多个实例会导致操作失败,推荐用虚拟机之类,但是手头仅有一台机子,多个虚拟机会不会太重了,有什么更好的思路么,或者非常轻便仅仅跑浏览器足以的虚拟机,谢谢了。
    9 条回复    2019-08-23 13:25:14 +08:00
    ppokyou
        1
    ppokyou  
       2019-08-21 10:05:45 +08:00 via iPhone
    没看懂,多个 ie 实例跟多个虚拟机有什么关系?
    jackielu
        2
    jackielu  
       2019-08-21 10:07:09 +08:00
    尝试一下 pyppeteer
    otakustay
        3
    otakustay  
       2019-08-21 10:11:28 +08:00
    @jackielu 人家要 IE 你让人家用 puppeteer,啥逻辑……
    imyip
        4
    imyip  
       2019-08-21 10:14:59 +08:00
    本来想说 docker, 然后才看到了是 ie
    asus10tu
        5
    asus10tu  
    OP
       2019-08-21 10:19:40 +08:00
    @ppokyou 多个实例是打算开几个 ie 同时操作网页,但是这样会互相影响出问题,导致找不到元素,点不到之类,官方建议是开多个虚拟机,然后每个虚拟机运行一个 ie。
    Vegetable
        6
    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
        7
    asus10tu  
    OP
       2019-08-21 10:58:26 +08:00
    @Vegetable 保护模式的话,一开始 ie 有警告,所以已经全部打开了,还是如此。
    asus10tu
        8
    asus10tu  
    OP
       2019-08-21 15:40:16 +08:00
    有大佬给点点思路么,我已经想不到其他方法了
    ppokyou
        9
    ppokyou  
       2019-08-23 13:25:14 +08:00 via iPhone
    @asus10tu 可以试试以下两种思路:
    1. 在同一台测试机上启动多个实例,但确保每个实例都是不同的 windows user,这样就可以隔离
    2. 测试机上装个 windows docker desktop,在不同的 container 里跑
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   994 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:50 · PVG 03:50 · LAX 12:50 · JFK 15:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.