Mar-13-2023, 04:27 AM
bump:
as I mentioned I am looking to scrape, using selenium,
<div class = "content list">
<div data-type = "events>
I am able to use a template, but I'm wondering if theres a way to do it with tag names or css names?
template = '//*[@id="main-content"]/div[2]/div/div[6]/div/div[2]/div[2]/div/div/div[{}]'
Image Link
here is my current code
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome("C:\Windows************************")
driver.get("https://www.fxva.com/events/?bounds=false&view=list&sort=date")
template = '//*[@id="main-content"]/div[2]/div/div[6]/div/div[2]/div[2]/div/div/div[{}]'
class Scraper:
def __init__(self):
self.h2 = []
self.h3 = []
def scrape(self):
for i in range(1, 10):
self.h2.append(template.format(i))
for i in self.h2:
self.h3.append(driver.find_element(By.XPATH, str(i)).text)
return self.h3
as I mentioned I am looking to scrape, using selenium,
<div class = "content list">
<div data-type = "events>
I am able to use a template, but I'm wondering if theres a way to do it with tag names or css names?
template = '//*[@id="main-content"]/div[2]/div/div[6]/div/div[2]/div[2]/div/div/div[{}]'
Image Link
here is my current code
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome("C:\Windows************************")
driver.get("https://www.fxva.com/events/?bounds=false&view=list&sort=date")
template = '//*[@id="main-content"]/div[2]/div/div[6]/div/div[2]/div[2]/div/div/div[{}]'
class Scraper:
def __init__(self):
self.h2 = []
self.h3 = []
def scrape(self):
for i in range(1, 10):
self.h2.append(template.format(i))
for i in self.h2:
self.h3.append(driver.find_element(By.XPATH, str(i)).text)
return self.h3