selenium / main.py
navpan2's picture
Update main.py
658b4c7
raw
history blame
892 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
print("load complete")
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)
print("driver start")
url= 'https://navpan2-dockerbot.hf.space/'
driver.get(url)
print("sleep me")
time.sleep(5)
print("uth gya")
soup = BeautifulSoup(driver.page_source,'lxml')
headings = soup.find_all( name= 'span')
for heading in headings:
print(heading.getText())
print("fir sounga")
time.sleep(2)
driver.quit()