推荐学习书目
› 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
woshichuanqilz
V2EX  ›  Python

selenium 找不到 页面元素, 页面已经显示了但是还是找不到

  •  
  •   woshichuanqilz · Oct 21, 2017 · 4891 views
    This topic created in 3284 days ago, the information mentioned may be changed or developed.

    这个是网页 https://www.igxe.cn/product/578080/602885 当点击出售的时候, 售价是可以获取到的,

    但是点击求购的时候,

    1

    元素已经显示了, 但是获取不到, 这个是怎么回事

    2

    我看了, 不是 frame 的问题, 输出这个页面的内容这个元素也是有的, 就是不知道怎么会出现这个问题。

    selenium click 求购页面下的元素是显示元素不可见, 但是这个元素命名是能看到的。 不知道为什么有这个问题所以, 就指教。

    5 replies  •  2017-10-21 09:18:18 +08:00
    woshichuanqilz
        1
    woshichuanqilz  
    OP
       Oct 21, 2017
    driver_sell.find_element_by_css_selector('#product_purchases').click()
    time.sleep(2)

    print(driver_sell.find_element_by_css_selector('#js-tbody-data > tr:nth-child(1) > td:nth-child(3) > span').text)


    这个就是对应的代码 print 的是空的, 但是如果打出这个页面的 source code 元素都是存在的
    nazor
        2
    nazor  
       Oct 21, 2017 via iPhone
    ……有可能 html 语法错误

    实在不行就用正则表达式啊
    lovestudykid
        3
    lovestudykid  
       Oct 21, 2017
    这也能弄个交易所...服
    hcnhcn012
        4
    hcnhcn012  
       Oct 21, 2017 via iPhone
    心疼 IG,刚经历完封号风波还要不停反爬虫
    woshichuanqilz
        5
    woshichuanqilz  
    OP
       Oct 21, 2017
    问题是这个元素已经显示出来了为什么程序里面还是显示隐藏。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2666 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 10:25 · PVG 18:25 · LAX 03:25 · JFK 06:25
    ♥ Do have faith in what you're doing.