Tarakeswararao Marla
Tarakeswararao Marla

Reputation: 337

how to resolve this error in python webscraping?

I imported selenium modules in python file but when i run this code I got

Traceback (most recent call last): 
File "koovs.py", line 4, in <module>
  browser=webdriver.Firefox()
File "C:\Users\hp\Anaconda2\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
  self.service.start()
File "C:\Users\hp\Anaconda2\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
  os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of
<selenium.webdriver.firefox.service.Service object at 0x0000000003228400>> ignored

What i have to do. My code is

from selenium import webdriver
from bs4 import BeautifulSoup
browser=webdriver.Firefox()
browser.get('http://www.koovs.com/women/dresses/sortby-discount-high/')
soup=BeautifulSoup(browser.page_source)

Upvotes: 1

Views: 146

Answers (2)

Madisetty Harish
Madisetty Harish

Reputation: 1

Go to the link and download geckodriver based on your windows 32 or 64 bit.

Extract the geckodriver.exe to your computer and add the corresponding path to Environmental variables.

For Example: if you extracted the geckodriver.exe to Desktop, you should add desktop path to Path Env. variable.

Then re-execute your code. Sometimes env. var don't reflect. In this case, you might need to restart your IDE (like Eclipse).

Hope it helps.

Upvotes: 0

yumere
yumere

Reputation: 199

Did you install geckodriver?

To use Firefox webdriver, You must install geckodriver. And put the binary file into folder which can be accessed by system PATH.

Upvotes: 1

Related Questions