Error using Selenium Chrome Webdriver with python

Question:

hi im using chrome driver but i cant fix this error

mycode:

options = Options()
        
        options.add_argument('--disable-gpu')
        options.add_argument('--disable-dev-shm-usage')
        self.site = webdriver.Chrome(executable_path="C:chromedriver.exe",chrome_options=options)
        
        
        self.site.get("https://sgite.com/en/site/")

error:
[23468:14696:1004/232130.459:ERROR:chrome_browser_main_extra_parts_metrics.cc(228)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[23468:14696:1004/232130.468:ERROR:chrome_browser_main_extra_parts_metrics.cc(231)] crbug.com/1216328: Checking Bluetooth availability ended.
[23468:14696:1004/232130.514:ERROR:chrome_browser_main_extra_parts_metrics.cc(234)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[23468:14696:1004/232130.588:ERROR:chrome_browser_main_extra_parts_metrics.cc(238)] crbug.com/1216328: Checking default browser status ended.

Asked By: saeed shiroo

||

Answers:

If you are using Selenium with Python then add these extra options into your Selenium code-

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
Answered By: Amar Kumar

This same thing worked for me like the answer above me.

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
driver.get('https://something.com/login')
driver.maximize_window()
Answered By: Tadej Blatnik

Exactly" for Python

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
browser = webdriver.Chrome(options=options)
Answered By: Renan Nunes

The below code is tested and works like a charm.

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
Answered By: user1513366

For the Javascript users, the solution is:

const { Builder } = require('selenium-webdriver')
const chrome = require('selenium-webdriver/chrome')
const options = new chrome.Options()
options.excludeSwitches(['enable-logging'])
const driver = new Builder()
   .forBrowser('chrome')
   .setChromeOptions(options)
   .build()
Answered By: Omar RB
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.