sách gpt4 ai đã đi

Python 中 xpath 的 Selenium 语法

In lại 作者:行者123 更新时间:2023-12-03 00:53:30 29 4
mua khóa gpt4 Nike

我正在尝试单击此网址 http://ecos.fws.gov/ecp0/profile/speciesProfile?sId=6994 处的文本,但无法想出正确的语法。

我想做的是点击“查看全部”,但不幸的是html中有多个“查看全部”。 html 看起来像这样:


  • Population location: Wherever found west of Mobile and Tombigbee Rivers in AL, MS, and LA


    Listing status: 
    Threatened




      • States/US Territories in which this population is known to or is believed to occur: 
        Alabama
        , Louisiana
        , Mississippi

      • US Counties in which this population is known to or is believed to occur: 
        View All

      • USFWS Refuges in which this population is known to occur: 
        Bogue Chitto National Wildlife Refuge, Egmont Key National Wildlife Refuge, Grand Bay National Wildlife Refuge, Hobe Sound National Wildlife Refuge, Mississippi Sandhill Crane National Wildlife Refuge





  • 我基本上需要选择 li 样式为“margin-bottom:1em;”的位置并包含“受威胁”和“查看全部”。不幸的是,对于提供的 url,有两个“查看全部”,并且都在 style =“margin-bottome:1em;”的 li 内。

    我只是想不出一种方法来唯一标识第一个“查看全部”。我正在考虑某种条件路径,但不确定

    1 Câu trả lời

    试试这个 xpath - "//span[@class='listingThreat']/ancestor::li//a[text()='View All']"

    关于Python 中 xpath 的 Selenium 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40746273/

    29 4 0
    行者123
    Hồ sơ cá nhân

    Tôi là một lập trình viên xuất sắc, rất giỏi!

    Nhận phiếu giảm giá Didi Taxi miễn phí
    Mã giảm giá Didi Taxi
    Giấy chứng nhận ICP Bắc Kinh số 000000
    Hợp tác quảng cáo: 1813099741@qq.com 6ren.com