0% found this document useful (0 votes)
3 views1 page

From Selenium Import Webdriver

This document is a Python script that uses Selenium to open a specified URL in an incognito Chrome browser. It runs indefinitely, loading the page, waiting for it to be ready, and then clearing cookies before reloading after a 15-second pause. The script handles exceptions and allows the user to stop it gracefully with a keyboard interrupt.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

From Selenium Import Webdriver

This document is a Python script that uses Selenium to open a specified URL in an incognito Chrome browser. It runs indefinitely, loading the page, waiting for it to be ready, and then clearing cookies before reloading after a 15-second pause. The script handles exceptions and allows the user to stop it gracefully with a keyboard interrupt.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

from selenium import webdriver

from selenium.webdriver.chrome.options import Options


from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

# List of URLs to open


urls = ["https://www.profitableratecpm.com/xn5nkg4ni?
key=f45f5ee07e0d4bd8984e4b74f6144a91"]

# Set up Chrome options


chrome_options = Options()
chrome_options.add_argument('--log-level=3') # Suppress non-critical logs
chrome_options.add_argument('--incognito') # Use incognito mode for fresh sessions
# chrome_options.add_argument("--headless") # Uncomment for headless mode if
desired

# Initialize the WebDriver


driver = webdriver.Chrome(options=chrome_options)

try:
iteration = 1
while True: # Run indefinitely
for url in urls:
print(f"Iteration {iteration}: Opening {url}")
try:
driver.get(url) # Load the URL
print(f"Final URL: {driver.current_url}")
# Wait for page load (confirm page is ready)
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.TAG_NAME, "body"))
)
print("Page loaded successfully")
driver.delete_all_cookies() # Clear cookies to simulate a new
session
time.sleep(15) # Wait 15 seconds before reloading
except Exception as e:
print(f"Failed to load {url}: {type(e).__name__} - {str(e)}")
continue
iteration += 1
except KeyboardInterrupt:
print("\nScript stopped by user (Ctrl+C). Closing browser.")
finally:
driver.quit() # Close browser only when user stops the script

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy