================================================================================ # 1. We will access to site and change RGB elements on web page via selenium # 1. Then, we bring HTML from web page, and then, we parse RGB code via BeautifulSoup ================================================================================ from selenium import webdriver import time from bs4 import BeautifulSoup ================================================================================ browser=webdriver.Chrome("/home/young/chromedriverfolder/chromedriver") browser.get("https://www.w3schools.com/colors/colors_rgb.asp") time.sleep(2) ================================================================================ # id=r01, clear browser.find_element_by_css_selector("#r01").clear() browser.find_element_by_css_selector("#r01").send_keys("1") browser.find_element_by_css_selector("#g01").clear() browser.find_element_by_css_selector("#g01").send_keys("20") browser.find_element_by_css_selector("#b01").clear() browser.find_element_by_css_selector("#b01").send_keys("44") ================================================================================ # Get HTML source html=browser.page_source soup=BeautifulSoup(html,'html.parser') ================================================================================ # tag=div, id=hex01 color=soup.find("div",{"id":"hex01"}).text print(color) time.sleep(4) browser.quit()