Basics of webscraping using selenium

Firstly,you have to install selenium from PythonPackageIndex using pip command.

Ran the bellow code but an exception has occured.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# pyvirtualdisplayを用いる場合
from pyvirtualdisplay import Display
display = Display(visible=0, size=(1024, 768))
driver = webdriver.Firefox()
WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Seemed like there was not any ‘geckodriver’ in PATH..

In the first place,you must get geckodriver installed if you don’t have it.

you can download it following the instruction  in the page bellow.

Then,run the code bellow after ‘mkdir’ for geckodriver executable file.

export PATH=$PATH:’/Users/yoshinobuhiroaki/Desktop/geckodriverdir’

Screenshot 2016-11-14 17.09.05.png

Now,you can get the result like above if you successfully finished.