Continuing from the last time, this time I would like to use
Selenium to perform scraping.
I tried to summarize the cssSelector required for Selenium locator Get specific elements in Python Selenium Basics of Python and Selenium [Python] find_elements_by_css_selector ・ ・ ・ Get elements from css selector [Python3] Scraping via browser (dynamic pages, etc.) [Selenium] Organize HTML tags / elements / attributes / CSS properties Three settings to make for stable operation of Selenium (also supports Headless mode)
When using selenium, I use
find_element_by_css_selector ("selector") to get the desired css selector from the source code, but first I have to read the HTML hierarchy myself. I was wondering.
After reading various articles, I was wondering why these people were able to get the css selector properly, but it seems that they can copy the source code.
① Right-click on the web page where you want to automatically click on that location (2) Press the verification button to verify, and check that the location of the source code you want is marked. ③ Right-click on the source code and press copy. There is a copy selector, so press it. ④ If you paste it in the editor, the desired css selector will be displayed.
It is possible to get the
css selector in the flow like.
contains a list, but ʻelements contains a single number
clear can clear the value entered in advance in the search box.
Therefore, if you want to search by entering something in the search box, you can delete the pre-filled values and search only what you want to search.
is ** only one can be used per web page **, but class` can be used many times per page. Therefore, it is easier to access the information you want to get by searching by id.
I managed to create a process that
automatically likes on Instagram and
When I made it, the mechanism was surprisingly interesting, so I enjoyed making it.