Python Forum
Selenium to pick data from csv and enter into website - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Selenium to pick data from csv and enter into website (/thread-4783.html)



Selenium to pick data from csv and enter into website - Prince_Bhatia - Sep-08-2017

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.


RE: Selenium to pick data from csv and enter into website - hbknjr - Sep-08-2017

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.