0

is there a way i can run selenium without it popping out?

i am using windows and using python 3.8.

i have tried using the "ghostdriver" but it didn't work for some reason.

here is what im using selenium for:

from selenium import webdriver from selenium.webdriver.common.keys import Keys from getpass import getpass import time import os import password_for_github #C:\Users\no\Downloads\chromedriver_win\chromedriver.exe chrome driver rep_name = str(input("rep name: ")) descrepition = str(input("rep description: ")) username = '[email protected]' password = password_for_github.password_HELLO password1 = password_for_github.password_HELLO if password == password1: driver = webdriver.Chrome('C:\\Users\Anas\Downloads\chromedriver_win\chromedriver.exe') driver.get('https://github.com/login') time.sleep(1) username_login = driver.find_element_by_id("login_field") username_login.send_keys(username) time.sleep(0.001) password_login = driver.find_element_by_id("password") password_login.send_keys(password) time.sleep(0.001) login_button = driver.find_element_by_xpath('//*[@id="login"]/form/div[4]/input[9]') login_button.submit() time.sleep(0.0001) driver.get("https://github.com/new") new_projectname = driver.find_element_by_id("repository_name") new_projectname.send_keys(str(rep_name)) project_description = driver.find_element_by_xpath('//*[@id="repository_description"]') project_description.send_keys(descrepition) create_rep = driver.find_element_by_xpath('//*[@id="new_repository"]/div[4]/button') create_rep.submit() driver.quit() elif password != password1: print("wrong password try again (restart) ") 

1 Answer 1

2

I think you are looking for headless Chrome

from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('headless') path = 'C:\\Users\Anas\Downloads\chromedriver_win\chromedriver.exe' driver = webdriver.Chrome(path, options=options) 
Sign up to request clarification or add additional context in comments.

2 Comments

where do i put the path to the webdriver
I've edited my answer if you want to specify path do chromedriver

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.