

Then will This will work with both Python 2.7 and Python 3. To use the PhantomJS webdriver, all you need to do is change it to PhantomJS().Įxample PhantomJS code: from selenium import webdriverĪfter importing the selenium module, we create the webdriver object using

On Microsoft Windows or Linux, get PhantomJS from the official site. On Apple Mac you can install PhantomJS with the line: brew install phantomjs Like the other web drivers, the PhantomJS driver needs to be installed.

To design the process, you can change the webdriver to ChromeDriver or FirefoxDriver and change it to PhantomJS once its working.īrowser Automation with Python Selenium Install PhantomJS Unlike the FirefoxDriver or ChromeDriver, the browser stays totally invisible during the process. PhantomJS is a headless browser that can be used with the Selenium web automation module.
