Python Selenium Set up in IntelliJ Idea for Windows

[ For Windows ]


1. Download and Install latest python from https://www.python.org/downloads/

2. After installation go to system environment variables and check for the path of python.

that path must be looks like ~~\AppData\Local\Programs\Python\Python310\Scripts


3. Now run the mandatory commands below for installing Selenium and WebDriver Manager.

Note :- Manual webdriver(e.g. chrome/ firefox etc.) path is not working now. Hence we have to install WebDriverManager through pip command.

=== For Selenium ==

pip install selenium 


=== For WebDriver Manager ==

pip install webdriver-manager


4. Download and install intellij Idea community edition from https://www.jetbrains.com/idea/download/#section=windows


5. After success full installtion open the Intellij Idea Editor.


6. Go to File -> Settings -> plugins :: and search for python community edition and install from marketplace.


7. Now go to File -> new -> Project and create a fresh python project


8. Create a fresh python  (LaunchBrowser.py ) file and paste the below code. 

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

chromeD = webdriver.Chrome(service=Service(ChromeDriverManager().install()));
chromeD.get("https://www.google.co.in/");
print("!!! Welcome to Google Home Page !!! ");
chromeD.maximize_window();
time.sleep(2)
chromeD.close();
chromeD.quit();

9. Right click on the LaunchBrowser.py file and Run the test.

Comments