Home > Software engineering >  having trouble with a function
having trouble with a function

Time:10-12

I am trying to put this in a function:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

driver = webdriver.Chrome(options=chrome_options)
driver.get("chrome://newtab/")

In all of my other attempts it just looks similar to this:

def vpn():
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    chrome_options = Options()
    chrome_options.add_argument('--no-sandbox')
    chrome_options.add_argument('--disable-dev-shm-usage')
    
    driver = webdriver.Chrome(options=chrome_options)
    driver.get("chrome://newtab/")

vpn()

And it just loads forever

I do know that it shouldn't do anything because i never returned anything but i just have no idea what to return.

Does anyone know something that i don't?

I would consider myself a very advanced beginner of python.

CodePudding user response:

You need to put an actual website in the driver.get() function.

driver.get('http://www.google.com/')
  • Related