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
jahan
V2EX  ›  Python

请教 selenium 中的鼠标动作为何不工作呢?

  •  
  •   jahan · 2017-11-21 01:43:42 +08:00 · 2080 次点击
    这是一个创建于 2342 天前的主题,其中的信息可能已经有所发展或是发生改变。

    safari 11(highserria) 环境,有一个 element 需要鼠标 hover 上才能显示,想实现 hover 并点击的动作,可是在给足了加载时间之后,执行下面的代码,鼠标不悬停 element 不显示。 zoom_out_button = driver.find_element_by_class_name('zoom-out-right-button-control-bar') print('Visiable?', zoom_out_button.is_displayed()) fasle ActionChains(driver).move_to_element(zoom_out_button).click(zoom_out_button).perform() 想请教一下为什么 action 不工作呢?下面是目标 js。也就是 https://www.tradingview.com/chart/f8my3Ybg 图表下方的放大缩小图标。google 说 safari 和 chrome 有个缺陷,不过确认了不是我这个版本。有点闹不明白了。

    ………… http://www.w3.org/2000/svg" viewbox="0 0 120 120" width="16" height="16" class="zoom-out-right-button-control-bar"> …… <
    3 条回复    2017-11-21 13:50:25 +08:00
    kran
        1
    kran  
       2017-11-21 07:44:21 +08:00 via iPhone
    直接修改 css 不可以吗
    jahan
        2
    jahan  
    OP
       2017-11-21 09:29:03 +08:00
    @kran google 过程中看到过这个思路,就是没看到代码,不知道要去学那部分知识
    kran
        3
    kran  
       2017-11-21 13:50:25 +08:00
    不是有 executeScript 吗,用它来修改样式呀
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   912 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:57 · PVG 04:57 · LAX 13:57 · JFK 16:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.