I am on a mac and I am trying to use selenium with phantomjs. I have downloaded the phantomjs executable for mac from their website, and I don't know where to place it for selenium to use it. I am using Visual Studio Code, a Mac and python 3.7. Thanks
Place it anywhere! Yes anywhere. Even i place it in a separate folder named setups where i store all webdrivers including PhantomJS.exe
also. It works well. No errors.
Just add it to the path in the code itself :
driver = webdriver.PhantomJS(executable_path=r"C:\Users\intel\Downloads\setups\PhantomJS.exe")
Either use PhantomJS.exe
after the path name just like i did it above or use PhantomJS
only.
Edit :
PhantomJS
support has been ended recently because it's too old, and is no longer maintaining. The message you are getting is not an error, it's a warning. I prefer you using chrome browser here.
You can even make chrome browser headless
just like PhantomJS
.
To do that :
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless")
driver = webdriver.Chrome(executable_path=r"C:\Users\intel\Downloads\setups\chromedriver.exe", options=options)
Also don't forget to use options=options
in the end of the path just like i did.