美文网首页
ul的使用

ul的使用

作者: 81fe5084e6c1 | 来源:发表于2017-04-04 08:49 被阅读7次

    ```

    MyList = browser.ul(:id => "PageContent_cat")

    #Scrape links from the UL for visiting

    MyList.links.each do |link|

    puts link

    puts link.text

    b.goto(link)

    #etc

    end

    #Save li items to an array for later processing

    MyArray = []

    MyList.lis.each do |li|

    puts li.text

    MyArray << li.text

    #etc

    end

    #Iterate through your array in the same method, to report/visit/etc

    MyArray.each do |item|

    puts "I collected something: #{item}"

    b.goto(item)

    end #

    ```

    相关文章

      网友评论

          本文标题:ul的使用

          本文链接:https://www.haomeiwen.com/subject/uxjaottx.html