Python Selenium Module
Python Selenium Module
Python Selenium is a Python module with which you can write automation programs that can handle your daily tasks in the browser on your system.Using this module and Python, you can very easily create programs that send data to any site on the internet, save posts, create accounts, log in to accounts, and perform automatic analysis for account data.
The best part of the Selenium module is that it acts like a real person while doing all these things.
Python Selenium Installation
The first thing you need to do in Selenium installation is to download the web drivers.
You need to download the drivers for whichever browser you are going to use. Be sure to download according to your operating system.
After downloading the Web Driver, create a folder on your desktop and put it there. For example, I created a folder named Selenium and put the Firefox driver inside it.
Now that we have downloaded the driver, we can move on to the installation of the Selenium module.
I'm explaining for Windows, but it's not very different for other operating systems.
With the latest Python versions, the Pip Python package installer comes pre-installed and with the help of this installer we can easily install the Selenium module to our system.
We open CMD and type "pip3 install selenium" and press enter, then the system automatically completes the installation.
If you have encountered a screen like this, the installation has been completed successfully, now all that's left is to write the code.
Let's open any page with Firefox and test whether the Selenium module is installed.
from selenium import webdriver
tarayici = webdriver.Firefox(executable_path="C:\\Users\\ahmet\\Desktop\\selenium\\geckodriver.exe")
tarayici.get("https://urhoba.blogspot.com")Let's open any page with Google Chrome and test whether the Selenium module is installed.
from selenium import webdriver
tarayici = webdriver.Chrome(executable_path="C:\\Users\\ahmet\\Desktop\\selenium\\geckodriver.exe")
tarayici.get("https://urhoba.blogspot.com")Here, after "executabe_path=" you need to write the location of the web driver you downloaded. Since I put the web driver I downloaded in a folder named selenium on the desktop, I wrote that address.
Note: When testing, use whichever browser driver you downloaded and whichever browser you have installed on your system.


Yorum Gönder