ChasYuan
V2EX  ›  问与答

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

  •  
  •   ChasYuan · Apr 8, 2017 · 2732 views
    This topic created in 3349 days ago, the information mentioned may be changed or developed.
    <a class="city J-city">
        ::before
        北京
        <i class="icon i-arrow"></i>
    </a>
    

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

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

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

    2 replies    2017-04-08 11:36:09 +08:00
    blanu
        1
    blanu  
       Apr 8, 2017 via iPhone   ❤️ 1
    加上 before 伪元素选择器
    ChasYuan
        2
    ChasYuan  
    OP
       Apr 8, 2017 via Android
    我试试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   908 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:55 · PVG 04:55 · LAX 13:55 · JFK 16:55
    ♥ Do have faith in what you're doing.