Python, PhantomJS says I am not using headless?
Selenium considers PhantomJS as deprecated, so you need to us either Chrome or Firefox in headless mode.
Here are the steps to use Chrome in headless mode:
- download chrome driver from https://sites.google.com/a/chromium.org/chromedriver/getting-started
- extract it to a folder
- add this folder to your PATH environment variable (if you don't do it, you will have to use
webdriver.Chrome('/your/path/to/chromedriver')
in the code below instead of webdriver.Chrome())
Then use it like this:
from selenium import webdriver# prepare the option for the chrome driveroptions = webdriver.ChromeOptions()options.add_argument('headless')# start chrome browserbrowser = webdriver.Chrome(chrome_options=options)browser.get('http://www.google.com/xhtml')print(browser.current_url)browser.quit()
More on how to use ChromeDriver
For the other options: here (also here and here)