July 28, 2022 at 3:47 AM
Hello fellow brothers in the community.
I'll give you an introduction to Python + Selenium.
First, a few remarks:
1. I am Chinese, I just found out about this forum, I like it very much. After I successfully registered, I need to upgrade my account level, after contacting the administrator, the administrator did not ask for my money, on the contrary, the management Very generously gifted to my highest tier members. This moved me very much.
2. In the current world, everything has to do with money, and I don't want to do that in the next knowledge sharing. In China, there is an old saying, "Give someone a rose, and leave a fragrance in your hand". Translated into English, it roughly means: "If you give roses to others, your hands will have fragrance." Therefore, I feel that in the community , money is not very important.
3. There are many people in the community with better technology than me, so I must always be humble and cautious. If there is an incorrect method, I need everyone to communicate.
4. Most important: If you benefit from learning in the community, then you make a lot of money and have extra time, please give back to the community as well.
By: breached.to -> tianyi2001 [2022/07/28]
***
The development environment, I use Pycharm, of course, you can use free vscode, or other development tools.
The specific development environment configuration, I am not going to explain in detail here, because it may lead to too much text in the post and affect viewing.
***
一、First, let's get acquainted with the general flow of the previous code.
If nothing else, you should now see that you have Bing turned on by controlling Selenium.
This example is very simple, don't think it's very simple, just have the courage to keep trying. Even though it's just less than 50 lines of code, it will take you on a journey and drive far away.
I'll give you an introduction to Python + Selenium.
First, a few remarks:
1. I am Chinese, I just found out about this forum, I like it very much. After I successfully registered, I need to upgrade my account level, after contacting the administrator, the administrator did not ask for my money, on the contrary, the management Very generously gifted to my highest tier members. This moved me very much.
2. In the current world, everything has to do with money, and I don't want to do that in the next knowledge sharing. In China, there is an old saying, "Give someone a rose, and leave a fragrance in your hand". Translated into English, it roughly means: "If you give roses to others, your hands will have fragrance." Therefore, I feel that in the community , money is not very important.
3. There are many people in the community with better technology than me, so I must always be humble and cautious. If there is an incorrect method, I need everyone to communicate.
4. Most important: If you benefit from learning in the community, then you make a lot of money and have extra time, please give back to the community as well.
By: breached.to -> tianyi2001 [2022/07/28]
***
The development environment, I use Pycharm, of course, you can use free vscode, or other development tools.
The specific development environment configuration, I am not going to explain in detail here, because it may lead to too much text in the post and affect viewing.
***
一、First, let's get acquainted with the general flow of the previous code.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# 2022-07-28
# Breached.to Bullet Class:
# THE FAST ONLINE VERSION 1.0CB
# Import selenium package
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
if __name__ == '__main__':
"""
Create a selenium object, then you can use the methods of this object, if you don't understand, you can ignore it, copy and paste with me
"""
# Custom option parameters
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("excludeSwitches", ["enable-logging"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument('disable-cache')
options.add_argument('-ignore-certificate-errors')
options.add_argument('-ignore -ssl-errors')
# Download the Chrome kernel locally, then, we load it
_chromePath = r"r:\chromedriver.exe"
# Use Service(), initialize
chromeService = Service(_chromePath)
# The only thing to note about the two parameters here is options. In the front, we customized these options, then DRIVER will use it as we customized
DRIVER = webdriver.Chrome(options=options, service=chromeService)
# We use https://www.bing.com as an example
BASE_URL = "https://www.bing.com"
DRIVER.get(BASE_URL)
If nothing else, you should now see that you have Bing turned on by controlling Selenium.
This example is very simple, don't think it's very simple, just have the courage to keep trying. Even though it's just less than 50 lines of code, it will take you on a journey and drive far away.

