Cannot use selenium web driver because phantomjs is not in path
Hi! I'm trying to use selenium on my code but i cannot because phantomjs is not in path
.
Here is my log:
/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless '
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'phantomjs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "animeflv.py", line 257, in <module>
print(json.dumps(get_anime_data('https://www3.animeflv.net/anime/majutsushi-orphen-hagure-tabi-kimluckhen'), indent=4))
File "animeflv.py", line 154, in get_anime_data
driver = webdriver.PhantomJS()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 56, in __init__
self.service.start()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
Basically, phantomjs is not in path. How can I fix it?
selenium must be using phantomjs which is apparantly a different lib. Try installing it with
npm i phantomjs
something like that, or maybe it just doesn't work.
did you install it?
pip install PACKAGE
if that doesn't work, then it's probably not available in repl.it
@RYANTADIPARTHI its already installed. Its like one of those packages that already comes with python
@Necrodragon41 maybe it's not available on repl.it
@RYANTADIPARTHI Its available on replit, I have searched
can I see your code to see what's the problem?
driver = webdriver.PhantomJS()
html = driver.get(link)
soup = bs.BeautifulSoup(html, 'lxml')
@Necrodragon41 did you install selenium
@XThacker yeah. Its already installed. Notice that the exception is from selenium
@Necrodragon41 then...I dunno :(
@XThacker basically i need to add phantomjs to path'phantomjs' executable needs to be in PATH.
Do you know how can I do that?
However, you can use webbot, which uses selenium, weird right?
Docs