我正试图从这个网站上获取过滤结果.
首先,我应用了过滤器"Código,descripión o referencea del phamplite",然后创建了一个新容器,并 Select 了选项"Contiene"&;最后,我搜索了一个特定的词(在本例中是"anestesia"),但我不知道如何从所有过滤结果中刮取结果表,以获得"descripionón del implicate"部分中出现的链接.
这是我的代码:
import random
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import requests
from lxml import html
s=Service('./chromedriver.exe')
driver = webdriver.Chrome(service=s)
driver.get('https://compranet.hacienda.gob.mx/esop/guest/go/public/opportunity/current?
locale=es_MX')
sleep(5)
driver.find_element(By.XPATH ,"//*[@id='widget_filterPickerSelect']/div[1]/input").click()
sleep(5)
driver.find_element(By.XPATH,"//*[@id='filterPickerSelect_popup1']").click()
sleep(5)
driver.find_element(By.XPATH,"//*[@id='projectInfo_FILTER_OPERATOR_ID']/option[2]").click()
sleep(5)
busqueda = driver.find_element(By.XPATH,"//*[@id='projectInfo_FILTER']")
busqueda.send_keys("anestesia")
busqueda.send_keys(Keys.ENTER)
特别是这是我想要刮的
<a href="#fh" class="detailLink" onclick="javascript:goToDetail('2110224', '01000');stopEventPropagation(event);" title="Ver detalle: PC-050GYR017-E140-2022 SERVICIO INTEGRAL DE ANESTESIA, PARA EL EJERCICIO DEL 1º">PC-050GYR017-E140-2022 SERVICIO INTEGRAL DE ANESTESIA, PARA EL EJERCICIO DEL 1º</a>
我需要找到链接.