selenium / temp.py
navpan2's picture
Upload 4 files
003e243
raw
history blame contribute delete
792 Bytes
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=chrome_options)
url= 'https://navpan2-dockerbot.hf.space/'
driver.get(url)
time.sleep(5)
soup = BeautifulSoup(driver.page_source,'lxml')
headings = soup.find_all( name= 'span')
for heading in headings:
print(heading.getText())
time.sleep(2)
driver.quit()