I write a code in python to scrape some data from a web site using selenium. this code completely work when i run it in system command line . But when i run it from xampp command line it give error and show this message
Traceback (most recent call last): File "C:\Users\Marajul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Users\Marajul\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\Marajul\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\xampp\htdocs\Dairy\API\toph\python\a.py", line 16, in driver = Chrome(webdriver) File "C:\Users\Marajul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\Marajul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver3.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
from selenium.webdriver import Chrome
import pandas as pd
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="dairy"
)
mycursor = mydb.cursor()
webdriver = 'chromedriver3.exe'
driver = Chrome(webdriver)
cnt=0
while 1:
page_nb=(str)(cnt);
url = "https://toph.co/submissions/filter?author=590d7d60de14194eb555201c&start="+page_nb+"&verdict="
cnt=cnt+64
driver.get(url)
quotes = driver.find_elements_by_class_name("syncer")
if(len(quotes)==0):
break
for quote in quotes:
row=quote.find_elements_by_tag_name("td")
link=row[2].find_elements_by_tag_name('a')
time1=row[3].find_elements_by_class_name('timestamp')
time=time1[0].get_attribute('data-time')
urlp=""
if(link):
urlp=link[0].get_attribute('href')
sql1="SELECT * FROM submission WHERE id=%s AND oj='toph'"
val1 = (row[0].text,)
mycursor.execute(sql1,val1)
myresult = mycursor.fetchall()
if(len(myresult)==0):
sql="INSERT INTO submission (id,dt,link,name,ver,oj) VALUES (%s,%s,%s,%s,%s,'toph')"
val=(row[0].text,time,urlp,row[2].text,row[7].text)
mycursor.execute(sql, val)
mydb.commit()
print("successfull")
driver.close()
i am not expert in python so please help me to fix this problem :)