V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ChasYuan
V2EX  ›  问与答

萌新求解,页面的元素取不到,一直为空。

  •  
  •   ChasYuan · 2017-04-08 10:31:29 +08:00 · 1921 次点击
    这是一个创建于 2546 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <a class="city J-city">
        ::before
        北京
        <i class="icon i-arrow"></i>
    </a>
    

    我用的 Jsoup 解析 html ,想要取到北京这个字符串,取到的值一直为空。 是我的选择器写的不对么?我写的是:

    select("a.city.J-city").text();
    

    我也试过一些其他的规则,都没有取到。
    前端这块了解得不多,求各位大大指点。

    2 条回复    2017-04-08 11:36:09 +08:00
    blanu
        1
    blanu  
       2017-04-08 11:06:46 +08:00 via iPhone   ❤️ 1
    加上 before 伪元素选择器
    ChasYuan
        2
    ChasYuan  
    OP
       2017-04-08 11:36:09 +08:00 via Android
    我试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5686 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 01:45 · PVG 09:45 · LAX 18:45 · JFK 21:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.