I want to scrape data from MCQs but they will provide me an error and also want to go to next page
and how I go on next pages to scrape all the MCQs data is there any feasible solution kindly tell us
import time
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
# options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920x1080")
options.add_argument("--disable-extensions")
chrome_driver = webdriver.Chrome(
service=Service(ChromeDriverManager().install()),
options=options
)
def supplyvan_scraper():
with chrome_driver as driver:
driver.implicitly_wait(15)
URL = 'http://www.tulsithakur.com/bankingquiztwo.php'
driver.get(URL)
time.sleep(3)
title = driver.find_element_by_xpath("//span[@id='quest']//text()")
option_1 = driver.find_element_by_xpath("//span[@id='onee']//text()")
option_2 = driver.find_element_by_xpath("//span[@id='two']//text()")
option_3 = driver.find_element_by_xpath("//span[@id='three']//text()")
option_4 = driver.find_element_by_xpath("//span[@id='four']//text()")
print(title,option_1,option_2,option_3,option_4)
supplyvan_scraper()