Попытка очистить указанный ниже веб-сайт. После извлечения href из a-тегов он не возвращает ничего. Но в этих тегах есть элементы. Вот код:
from selenium import webdriver
import time
from bs4 import BeautifulSoup
driver = webdriver.Chrome(r"E:\chromedriver_win32\chromedriver.exe")
url= "https://www.adb.org/projects/tenders/sector/information-and-communication-technology-1066"
driver.get(url)
content = driver.page_source.encode('utf-8').strip()
soup = BeautifulSoup(content,"html.parser")
div_tags = soup.findAll("div",{"class":"item-title"})
for tags in div_tags:
a_tag=tags.find('a')
link=a_tag.get('href')
print(link)
div_tags
-вывод напечатан:
[<div class="item-title">
<a href="/node/606921"><div class="item-title">Corporate Innovation Expert</div></a></div>, <div class="item-title">Corporate Innovation Expert</div>, <div class="item-title">
<a href="/node/605571"><div class="item-title">Communications Specialist</div></a></div>, <div class="item-title">Communications Specialist</div>, <div class="item-title">
<a href="/node/603231"><div class="item-title">Venture Partner Expert</div></a></div>, <div class="item-title">Venture Partner Expert</div>, <div class="item-title">
<a href="/node/457636"><div class="item-title">Partnerships & Communications Manager</div></a></div>, <div class="item-title">Partnerships & Communications Manager</div>, <div class="item-title">
<a href="/node/545151"><div class="item-title">Operations Associate</div></a></div>, <div class="item-title">Operations Associate</div>, <div class="item-title">