Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.0 kB
23
Indexable
Never
"""
FF=23s,24s
Cr=11s,11s
"""
from selenium import webdriver
from selenium_stealth import stealth
import time
import socket
Machn = socket.gethostname()

options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument('--start-maximized');
options.add_argument('--start-fullscreen');

options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
if Machn=="E595":#E595 needs (probably) selenium_v4.8.3:
    options.binary_location = "D:\\Cr79\\chrome.exe"

driver = webdriver.Chrome(options=options)
if Machn=="E595":
    from selenium.webdriver.chrome.service import Service
    driver = webdriver.Chrome(options=options, service=Service('D:\Cr79\chromedriver.exe'))
#InsteadOfAbove2Lines;AlsoWorksAsOf2023-06-02:driver = webdriver.Chrome(options=options, executable_path=r'D:\Cr79\chromedriver.exe')

stealth(driver, #Maybe note out line below if not E595.
        #user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36", #UngoogledChromiumPrtblE595Win10NWstVersionAsOf2023-06-02. Probably very common, but not too common. If u want original: #(="note") this line out.
        languages=["en-GB", "en"], #better than en-US.
        vendor="Google Inc.", #Always correct.
        platform="Win32", #Always correct.
        webgl_vendor=[],#Original:webgl_vendor="Intel Inc.",
        renderer=[],#Original:renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

url = "https://bot.sannysoft.com/"
driver.get(url)
driver.save_screenshot("ScrnSht.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht0.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht1.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht2.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht3.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht4.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht5.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht6.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht7.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht8.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnSht9.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnShtA.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnShtB.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnShtC.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnShtD.png")
driver.execute_script("window.scrollBy(0, 500)")
driver.save_screenshot("ScrnShtE.png")
driver.execute_script("window.scrollBy(0, 500)")
#time.sleep(5)
driver.quit()