Skip to content Skip to sidebar Skip to footer

How To Write A Text List To A Defined Csv File? Python Selenium Scraping

I am new to Python, so please forgive me if this is a simple issue. I am web scraping an entire experience section from Linkedin using Selenium. Below is my relevant code: from tim

Solution 1:

Try this:

from selenium import webdriver

ChromeOptions = webdriver.ChromeOptions()
driver = webdriver.Chrome('/home/shubham/Downloads/chromedriver')
driver.get('https://www.linkedin.com/in/pauljgarner/')


rows = []

name = sel.xpath('normalize-space(//li[@class="inline t-24 t-black t-normal break-words"])').extract_first()
experience = driver.find_elements_by_xpath('//section[@id = "experience-section"]/ul//li')

rows.append([name])
for item in experience:
    rows[0].append(item)
    print(item.text)
    print("")

with open(parameters.file_name, 'w', encoding='utf8') as file:
    writer = csv.writer(file)
    writer.writerows(rows)

Post a Comment for "How To Write A Text List To A Defined Csv File? Python Selenium Scraping"