Skip to main content
edited tags
Link
Super Kai - Kazuya Ito
  • 43.1k
  • 23
  • 260
  • 259
deleted 8 characters in body; edited tags; edited title
Source Link
Super Kai - Kazuya Ito
  • 43.1k
  • 23
  • 260
  • 259

headless Headless option not working selenium python

hereHere is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.options import DesiredCapabilities
PATH='C:\Coding_projects\chromedriver.exe'
options = Options()
driver=webdriver.Chrome(PATH,options=options)
def open_ouedkniss():
    
    options.add_argument('headless')
    driver.get("https://www.ouedkniss.com/")
    ad_button=driver.find_element_by_id('header_interstitiel_exit')
    ad_button.click()
    search_bar=driver.find_element_by_id('menu_recherche_query')
    search_bar.click()
    search_bar.send_keys('golf 6')
    search_bar.send_keys(Keys.RETURN)
    
    
    
open_ouedkniss()

whenWhen I run the code everything works fine but the browser window still opens even with the headless option can someone tell me why?

headless option not working selenium python

here is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.options import DesiredCapabilities
PATH='C:\Coding_projects\chromedriver.exe'
options = Options()
driver=webdriver.Chrome(PATH,options=options)
def open_ouedkniss():
    
    options.add_argument('headless')
    driver.get("https://www.ouedkniss.com/")
    ad_button=driver.find_element_by_id('header_interstitiel_exit')
    ad_button.click()
    search_bar=driver.find_element_by_id('menu_recherche_query')
    search_bar.click()
    search_bar.send_keys('golf 6')
    search_bar.send_keys(Keys.RETURN)
    
    
    
open_ouedkniss()

when I run the code everything works fine but the browser window still opens even with the headless option can someone tell me why?

Headless option not working selenium python

Here is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.options import DesiredCapabilities
PATH='C:\Coding_projects\chromedriver.exe'
options = Options()
driver=webdriver.Chrome(PATH,options=options)
def open_ouedkniss():
    
    options.add_argument('headless')
    driver.get("https://www.ouedkniss.com/")
    ad_button=driver.find_element_by_id('header_interstitiel_exit')
    ad_button.click()
    search_bar=driver.find_element_by_id('menu_recherche_query')
    search_bar.click()
    search_bar.send_keys('golf 6')
    search_bar.send_keys(Keys.RETURN)
    
open_ouedkniss()

When I run the code everything works fine but the browser window still opens even with the headless option can someone tell me why?

Source Link

headless option not working selenium python

here is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.options import DesiredCapabilities
PATH='C:\Coding_projects\chromedriver.exe'
options = Options()
driver=webdriver.Chrome(PATH,options=options)
def open_ouedkniss():
    
    options.add_argument('headless')
    driver.get("https://www.ouedkniss.com/")
    ad_button=driver.find_element_by_id('header_interstitiel_exit')
    ad_button.click()
    search_bar=driver.find_element_by_id('menu_recherche_query')
    search_bar.click()
    search_bar.send_keys('golf 6')
    search_bar.send_keys(Keys.RETURN)
    
    
    
open_ouedkniss()

when I run the code everything works fine but the browser window still opens even with the headless option can someone tell me why?