Python Forum

Full Version: Selenium to pick data from csv and enter into website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
please give a runnable sampMy question, i have a csv file containing lots of data that needed to be enter into my office backend system.

All i need is there any article or video which is explaining that how pick data from csv and enter into website.

or any example that someone can show here will be helpful.

please if someone can explain it to me or to the community, it will be in benefit for all who are searching for samething over internet.
Picking data from CSV: a. python CSV module
b. video tutorial - https://www.youtube.com/watch?v=q5uM4VKywbA

Selenium: read the documentation.

example script: It opens python-forum and searches a string.

from selenium import webdriver
search_query = 'hbknjr'
browser = webdriver.Chrome()        # alternatively: browser = webdriver.Chrome(pathtowebdriver)
browser.get("about:blank")
browser.get("https://python-forum.io/index.php")
search_textbox = browser.find_element_by_xpath('//*[@id="search"]/input[1]')   #XPATH can be found with developer tools in browsers
search_textbox.send_keys(search_query)
search_btn = browser.find_element_by_xpath('//*[@id="search"]/input[2]')
search_btn.click()
There are other ways to find an element and enter and manipulate data on a website, it'll be clear when you read the documentation.