zoukankan      html  css  js  c++  java
  • css选择问题

    <div class="col-lg-4 col-md-6 mb-4">
    <div class="card">
    
    <a href="/exercise/list_basic_detail/90008-E/"><img class="card-img-top img-fluid" src="/static/img/90008-E.jpg" alt=""></a>
    
    <div class="card-body">
    <h4 class="card-title">
    <a href="/exercise/list_basic_detail/90008-E/">Short Dress</a>
    </h4>
    <h5>$24.99</h5>
    </div>
    
    </div>
    </div>
    
    css('div .col')选取不到对象,返回空列表
    
    css('div[class*=col]')可以返回对象
    
    or xpath('//div//a[contains(@href,"list")]可以返回,此处注意"list"not'list'双引号
    response.css('.pagination li:nth-child(9)::attr(href)').get() 选区不到href的值,去掉)::attr(href)可以返回到正确的li
    response.css('.pagination li:nth-child(9)').re('href="(.*?)"')可以提取出来,re之后不用加get()
    response.css('.pagination li:nth-child(9)').re('href="(.*?)"')返回是列表,不能直接用response.follow,在
    response.css('.pagination li:nth-child(9)').re('href="(.*?)"')[0]提取出值
    response.css('a[class*=page]:contains("Next")').re('href="(.*?)"')[0]  。。。。contains() will match elements with the desired text block:,后面的“:”要紧跟,不要有空格
    
    
    
     
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- focus on what you want to be
  • 相关阅读:
    编写代码实现图片懒加载
    原型链
    算法问题:获取字符串中,不重复的且最长字符串的长度
    ES6 的 Set 方法
    Vue 的生命周期
    关于 Web 前端的各种优化
    JS 排序算法,冒泡排序,插入排序,选择排序,归并排序,sort排序
    web 的 XSS 和 CSRF 攻击
    TCP 的三次握手和四次挥手
    理解 四种清除浮动的方法
  • 原文地址:https://www.cnblogs.com/bamboozone/p/10423872.html
Copyright © 2011-2022 走看看