How to install Selenium + WebDriver #1 (geckodriver+chromedriver) for a client's automation project
Автор: Dr Pi
Загружено: 2021-01-31
Просмотров: 541
Описание:
If you need to submit data to a site in input fields, and want to see how to get started, install Selenium and the required webdriver and write your first script then check out the steps involved as I show how to install Selenium, geckodriver, and chromedriver and how to submit data to a web page (in this case : Wikipedia) but the general concept applies to any site.
You need to right click in your browser and find either the 'id' or the 'class' - 'id' is preferable.
You can choose which of the 2 browsers you want to use.
Geckodriver is required if you want to use Firefox, and ChromeDriver is required if you want to use Chrome as the browser to automate.
The versions are up to date as of January 2021...But as time goes by you will need to check your browser and get the matching version of chromedriver OR geckodriver.
Later in the project we will submit data FROM a CSV, and then scrape the response and parse it to get the required text to write BACK to a CSV as per the project brief.
__________ chapters ______________________
0:00 intro
0:34 pip install selenium
1:21 'geckodriver' needs to be in PATH
2:40 downloading 'geckodriver'
5:14 getting 'ChromeDriver'
10:17 submitting search string to wikipedia
13:17 selenium find_element_by_id
_____________________________________________
Visit redandgreen blog for more Tutorials
=========================================
🌏 http://redandgreen.co.uk/about/blog/
Subscribe to the YouTube Channel
=================================
🌏 / drpicode
Follow on Twitter - to get notified of new videos
=================================================
🌏 / rngweb
Buy Dr Pi a coffee (or Tea)
☕ https://www.buymeacoffee.com/DrPi
Thumbs up yeah? (cos Algos..)
#webscraping #tutorials #python
------------------------------- code ------------------------------------#
python -m pip install selenium #
install the correct webdriver to match your browser version #
import webdriver
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
create webdriver object
driver = webdriver.Chrome()
Web URL
driver.get('https://www.wikipedia.org/')
element = driver.find_element_by_id("searchInput")
element.clear()
element.send_keys('moon')
element.send_keys(Keys.RETURN);
time.sleep(10)
driver.close()
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: